I won't bore you with the details but I need to pass a command to a file without spaces, with each space it considers the next text to be a variable which is not the case. I need to be able to create a command with another character other than space or use hex characters to overcome this. Unfortunately I am completely locked to using this method as this file exists on 1000s of devices and I would need to change the file manually on each device, if I can workaround it's limitations then this would be the best solution for me.
Does anyone have any ideas if this is possible?
edit Hi guys for some more info, lets say I have the file test.sh, it has a function called echo_var, if I use the command for example
test.sh echo_var helloworld
The function will simply echo helloworld
If I say use the command
test.sh echo_var hello world
Only hello gets echoed as it considers "hello world" as two strings and only acknowledges the first one, the function takes each separated string as a variable and only uses the first variable ie hello. I need to make hello world one variable
The command I want to run is to restart a service ie
test.sh echo_var hello&&service apache2 restart
So both hello will be echoed and the service restarted. But after the space after service, the command is cut.
Here is the file (test.sh) I have to interact with, again this is on 1000s of devices and I need to work with it:
case "$1" in echo_var) echo "$2" ;;