Let's say I've got this script :
x-terminal-emulator -e bash -c 'echo hello > ~/text'
I call it foo.sh and make it executable.
If I execute this script I'll have a text file in my home folder containing the word 'hello'.
Now if I modify it to this :
x-terminal-emulator -e bash -c 'echo $1 > ~/text'
... and I execute it in a terminal like this :
./foo.sh hello
I get a text file in my home folder containing nothing.
foo.sh receives 'hello' as the first and only argument ($1). So why doesn't bash receive it ? Is there a way to pass one or several arguments from foo.sh to bash ?
I tried to store the argument inside a variable name and then export it but it didn't change the result.