19

I want to explain to some friends how to add multikey support to their linux systems at bootup but first I need them to make a bash script. I want to make a simple command for them to copy and paste and I'm testing out this command I made but it keeps throwing an error. Only when I add the shebang line which, well is important.

$ sudo echo -e "#!/bin/bash \nxmodmap \"keysym Alt_R = Multi_key\"" > /etc.init.d/multikey.sh

Any easy way to echo a shebang line?

1
  • 1
    nevermind, found out I just needed to use a raw string, ie ''
    – Isaiah
    Commented Aug 2, 2011 at 5:21

2 Answers 2

39

Use the other quotes.

sudo echo -e '#!/bin/bash\nxmodmap "keysym Alt_R = Multi_key"'
16

If you want to impress your friends use here documents not echo strings :-)

~$ cat << EOF > /etc/init.d/multikey.sh
> #!/bin/bash          
> xmodmap "keysym Alt_R = Multi_key"
> EOF
0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.