How to echo #!/ using shell or bash -
How to echo #!/ using shell or bash -
this question has reply here:
echo “#!” fails — “event not found” 4 answersi trying print #!/ via bash, doesn't print , instead prints following. 
parth@parth-ubuntu64:$ echo "#!\/" bash: !\/: event not found    edited: allow me create 1 more update. how create next work? think should utilize python instead of bash. reason why trying because, want pipe file requires sudo permission. way can execute sudo => sudo sh -c " echo > file "
sh -c 'echo \'#!/bin/bash \' '       
within double quotes (and history expansion enabled), ! has special meaning. print characters literally,  utilize single quotes instead of double:
$ echo '#!\/' #!\/    history expansion can disabled in interactive shell using set +h, allows  utilize double quotes:
$ set +h $ echo "#!\/" #!\/    in general, if not require variables interpolated (such in case), should utilize single quotes.
note not necessary escape /, can remove \ before if desired output #!/:
$ echo '#!/' #!/        bash 
 
  
Comments
Post a Comment