hi all!
I've been trying to get a .sh script to work the past days but I'm obviously not smart enough to grasp the concept, because it doesn't work.
the script is suppose to send a message via messenger, and the program messer the "solution"
but something isn't right, because it says
but then l when I check the output (see script bug check), the command is perfectly fine!
I've tried both bash and sh (#!/bin/bash & #!/bin/sh)
so when executing the command:
the var3 variable is set to:
and the end result is:
BUT! if I'm copying the var3 data, with a "normal copy text function" paste it into the terminal and press enter, it works flawless..
Logging in...
Sent message to Adam Larsson
so I'm wondering why?, if the var3 variable contains the correct command-string, why isn't it working when the script file tries to execute it..
I've been trying to get a .sh script to work the past days but I'm obviously not smart enough to grasp the concept, because it doesn't work.
the script is suppose to send a message via messenger, and the program messer the "solution"
but something isn't right, because it says
Logging in...
Invalid message - check your syntax
but then l when I check the output (see script bug check), the command is perfectly fine!
Bash:
#!/bin/sh
# populate var0
read -r var0<<-EOF
messer
EOF
# populate var1
read -r var1<<-EOF
--command='m "Adam Larsson" testing
EOF
# populate var2
read -r var2<<-EOF
$@ ...
EOF
var4="'"
# Join Forces
var3="$var0 $var1 $var2 $var4"
echo $var3>txt.txt # dumping result (bugcheck)
$var3 # Executing command
I've tried both bash and sh (#!/bin/bash & #!/bin/sh)
so when executing the command:
./script.sh testing testing
the var3 variable is set to:
messer --command='m "Adam Larsson" testing testing '
and the end result is:
Logging in...
Invalid message - check your syntax
BUT! if I'm copying the var3 data, with a "normal copy text function" paste it into the terminal and press enter, it works flawless..
Logging in...
Sent message to Adam Larsson
so I'm wondering why?, if the var3 variable contains the correct command-string, why isn't it working when the script file tries to execute it..