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 answers

i 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

Popular posts from this blog

formatting - SAS SQL Datepart function returning odd values -

c++ - Apple Mach-O Linker Error(Duplicate Symbols For Architecture armv7) -

php - Yii 2: Unable to find a class into the extension 'yii2-admin' -