I have a first script for exemple :

var1="hello world"
echo $var1

So, i want a script shell, which execute test1.sh according to condition :

for exemple :

if  [ $1= world ]; 
  #execute test1.sh

i don't know how to rely the two shells, if you have any suggestions i ll be thankfull !

  • 1
    Please find an answer to your question at the above link with a few more background info, too. Also $1 refers to the first argument after your script when you run it, you cannot define it as you do. bash script.sh world --> echo $1 in the script will return world. – FelixJN Dec 2 '19 at 15:48

your if condition is ill-formated. You likely look for something like

var1="hello world"
if [[ "$var1" == "$1" ]]; then echo $1 found; else echo $1 not found; fi

It will give output like

$ ./test1.sh "world world"
world world not found
$ ./test1.sh "hello world"
hello world found

You can call another bash script simply by its name like any normal programme or command

Not the answer you're looking for? Browse other questions tagged or ask your own question.