I am trying to use the screen program to sequence the following bash scripts
Can someone help me correct this like so when i execute it on a command line it will execute the screen command on scripts 22 through 25. Thanks for your help.
screen -4 -d -m -S script_worker{22…25} /backend/production/script_worker{22…25}.sh
must do script;
for i in {22…25}
{
screen -4 -d -m -S script_worker$i /backend/production/script_worker$i.sh
}
with 2 dots “. .” not 3
Hello,
I am having trouble running the screen command using bash:
Here is the script contained in test.sh
-----------------------------------------------
#!/usr/bin/env bash
shopt -s nullglob
for i in {$1..$2} {
/usr/bin/screen -4 -d -m -S script_worker$i /backend/production/script_worker$i.sh
}
-----------------------------------------------
from the command prompt if i issue the following bash command:
>bash test.sh 21 25
I get the following error:
------------------------------
test.sh: line 4: syntax error near unexpected token `/usr/bin/screen'
test.sh: line 4: ` /usr/bin/screen -4 -d -m -S script_worker$i /backend/production/script_worker$i.sh'
Can anyone shed some light on what i am doing wrong?
Thanks for your help.
I figured it out using backward compatible for loops:
#!/usr/bin/env bash
shopt -s nullglob
for ((i=$1;i<=$2;i++))
do
/usr/bin/screen -4 -d -m -S script_worker$i /backend/production/script_worker$i.sh
done
test:
bash test.sh 01 10