I've seen a few of these questions, and a few answers, but they only tells me how to echo the results to the screen, and often only refers to one character. I need to remove the chars
and keep the answer inside a variable
My $var3 is:
'/scripts/test1.sh', 'Alf Complete', '-', 'S1E1', '-', 'Episode 1', 'has', 'been', 'paused', 'hellfire', 'i', 'Engsub - Series', 'testing']
(It's an output from another program)
This is suppose to be converted to a command, and started by using "$var4" (and should look something like this)
/scripts/test1.sh Alf Complete - S1S1 - Episode 1...
So the question is, how can I remove the chars I don't want and keep the new data in a new variable (for example $var4)
I might add that I'm very new at both Linux and writing script.. so please, treat me as "stupid"..
I'm starting the script with:
The text behind the script is arguments left by the program that calls the script.
This is my current script
#!/bin/sh # populate var0 read -r var0<<-EOF messer # is the program that is going to be called in the end of this script EOF # populate var1 read -r var1<<-EOF --command='m "Adam Larsson" # this is the first arguments EOF # populate argumentsreal read -r argumentsreal<<-EOF $@ #this is the arguments that are posted by the application that calls this script EOF var4="'" # this adds the last closing ' to the code # Join Forces var3="$var0 $var1 $argumentsreal $var4" echo $var3>txt.txt # dumping result (bugcheck) $var3 # Executing command
This is my code so far, my biggest issue is that when I'm running it, the program messer says
Invalid message - check your syntax
But if I do
cat txt.txt I will get the result:
messer --command='m "Adam Larsson" testing test1,test2,test3
If I now copy that text line, and paste it on the command line, and press enter, it works perfectly.
So, why isn't it working when I'm running it from the script?