LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   echo '$1' (https://www.linuxquestions.org/questions/linux-software-2/echo-%241-574564/)

kaviazzz 08-03-2007 03:26 PM

echo '$1'
 
i trying to create a script to display on my g15 keyboard messages from amsn...

i could just use the following command on amsn

echo -e 'TO 2 2 2 1 "$name"\nTO 10 10 1 1 "$msg"\nTO 30 30 1 2 "aMSN"\nPR 1 1 160 9\n' > ~/.g15amsn

but amsn cannot execute the command echo on incoming message trigger

so i try now to create a bash script to do it

but my problem is than using echo, '' and variables doesnt work

i want to use the following command

echo -e 'TO 2 2 2 1 "$1"\nTO 10 10 1 1 "$2"\nTO 30 30 1 2 "aMSN"\nPR 1 1 160 9\n' > ~/.g15amsn

so i can just execute from amsn scriptname $name $msg

anyone knows how to use a variable inside ''

also tried to use "" instead of '' but event if it displays exactly the same in console if i dont use >~/.g15amsn, the driver wont get the expected chars.

Any clues ???

PatrickNew 08-03-2007 03:29 PM

The general rule is that variable expansion does occur within double quotes, but not single quotes. Odd that it didn't work for you.

kaviazzz 08-03-2007 03:39 PM

writing in kate i noticed that the color changes to red when i insert the ' ' when i take them off the variable works but it "driver" doesnt read the sequensed different commands... try it your self
typing echo '$USER' gives $USER

the whole command after -e is inside single quotes!!!

i just noticed that i posted to the wrong category... sorry about that

ciotog 08-05-2007 10:14 AM

You need to end the single quoted strings before starting double quoted strings, and vice versa:

echo -e 'TO 2 2 2 1 '"$1"'\nTO 10 10 1 1 '"$2"'\nTO 30 30 1 2 '"aMSN"'\nPR 1 1 160 9\n' > ~/.g15amsn

kaviazzz 08-17-2007 02:10 AM

i just test it fast and it worked thkz m8.... so anyone wants to view msn messages to g15 a fast way is just o add this on alarms... nothing special no wrapping !!!! bus is easy and usefull!! thkz again


All times are GMT -5. The time now is 03:27 AM.