Skip to main content
deleted 2 characters in body
Source Link
zipU2
  • 3
  • 1
  • 6

Raspbian (Jessy) - root@Raspberry Pi - Putty

In the Terminal i type in

finalquestion=0finalanswer=0

now i got a script with this code

#!/bin/bash
source /lib/lsb/init-functions

echo $finalanswer              #just as a test
if [ ! "$finalanswer" = "0" ]
then
        rm -r mnt/objects/all
        log_warning_msg "All Files has been deleted" || true
        touch its_over.txt
else
        let finalanswer=1
        log_action_msg "Var finalanswer was 0. setting back to 1" || true
fi

there is a cronjob that starts this script every hour

sooo. somewhere there must be an error. because he is reading the Variable $finalanswer as nothing.

that means variables that has been defined outside of this script will not work?

how do i fix this?

Raspbian (Jessy) - root@Raspberry Pi - Putty

In the Terminal i type in

finalquestion=0

now i got a script with this code

#!/bin/bash
source /lib/lsb/init-functions

echo $finalanswer              #just as a test
if [ ! "$finalanswer" = "0" ]
then
        rm -r mnt/objects/all
        log_warning_msg "All Files has been deleted" || true
        touch its_over.txt
else
        let finalanswer=1
        log_action_msg "Var finalanswer was 0. setting back to 1" || true
fi

there is a cronjob that starts this script every hour

sooo. somewhere there must be an error. because he is reading the Variable $finalanswer as nothing.

that means variables that has been defined outside of this script will not work?

how do i fix this?

Raspbian (Jessy) - root@Raspberry Pi - Putty

In the Terminal i type in

finalanswer=0

now i got a script with this code

#!/bin/bash
source /lib/lsb/init-functions

echo $finalanswer              #just as a test
if [ ! "$finalanswer" = "0" ]
then
        rm -r mnt/objects/all
        log_warning_msg "All Files has been deleted" || true
        touch its_over.txt
else
        let finalanswer=1
        log_action_msg "Var finalanswer was 0. setting back to 1" || true
fi

there is a cronjob that starts this script every hour

sooo. somewhere there must be an error. because he is reading the Variable $finalanswer as nothing.

that means variables that has been defined outside of this script will not work?

how do i fix this?

deleted 17 characters in body
Source Link
zipU2
  • 3
  • 1
  • 6

Raspbian (Jessy) - root@Raspberry Pi - Putty

In the Terminal i type in

finalquestion=0

now i got a script with this code

#!/bin/bash
source /lib/lsb/init-functions

echo $finalanswer              #just as a test
if [ ! "$finalanswer" = "0" ]
then
        rm -r mnt/objects/all
        log_warning_msg "All Files has been deleted" || true
        touch its_over.txt
else
        let finalanswer=1
        log_action_msg "Var finalanswer was 0. setting back to 1" || true
fi

there is a cronjob that starts this script every hour

sooo. somewhere there must be an error. because he is reading the Variable $finalanswer as nothing an i think i know it already. variables 

that means variables that has been defined outside of this script will not work.?

how do i fix this?

Raspbian (Jessy) - root@Raspberry Pi - Putty

In the Terminal i type in

finalquestion=0

now i got a script with this code

#!/bin/bash
source /lib/lsb/init-functions

echo $finalanswer              #just as a test
if [ ! "$finalanswer" = "0" ]
then
        rm -r mnt/objects/all
        log_warning_msg "All Files has been deleted" || true
        touch its_over.txt
else
        let finalanswer=1
        log_action_msg "Var finalanswer was 0. setting back to 1" || true
fi

there is a cronjob that starts this script every hour

sooo. somewhere there must be an error. because he is reading the Variable $finalanswer as nothing an i think i know it already. variables that has been defined outside of this script will not work.

how do i fix this?

Raspbian (Jessy) - root@Raspberry Pi - Putty

In the Terminal i type in

finalquestion=0

now i got a script with this code

#!/bin/bash
source /lib/lsb/init-functions

echo $finalanswer              #just as a test
if [ ! "$finalanswer" = "0" ]
then
        rm -r mnt/objects/all
        log_warning_msg "All Files has been deleted" || true
        touch its_over.txt
else
        let finalanswer=1
        log_action_msg "Var finalanswer was 0. setting back to 1" || true
fi

there is a cronjob that starts this script every hour

sooo. somewhere there must be an error. because he is reading the Variable $finalanswer as nothing. 

that means variables that has been defined outside of this script will not work?

how do i fix this?

Source Link
zipU2
  • 3
  • 1
  • 6

shell script - how to use variables for a shell script without defining the variable in the script

Raspbian (Jessy) - root@Raspberry Pi - Putty

In the Terminal i type in

finalquestion=0

now i got a script with this code

#!/bin/bash
source /lib/lsb/init-functions

echo $finalanswer              #just as a test
if [ ! "$finalanswer" = "0" ]
then
        rm -r mnt/objects/all
        log_warning_msg "All Files has been deleted" || true
        touch its_over.txt
else
        let finalanswer=1
        log_action_msg "Var finalanswer was 0. setting back to 1" || true
fi

there is a cronjob that starts this script every hour

sooo. somewhere there must be an error. because he is reading the Variable $finalanswer as nothing an i think i know it already. variables that has been defined outside of this script will not work.

how do i fix this?