Generating a bash script with echo, problem with shebang line
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?
Use the other quotes.
sudo echo -e '#!/bin/bash\nxmodmap "keysym Alt_R = Multi_key"'
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
精彩评论