Bash alias to script generating shebang text

382 views Asked by At

How to create an alias to short code snippet that generates shebang (#!/bin/bash) text?

I'm looking for something like:

alias createConfiger='echo -e "#!/bin/bash\necho configvalue" > printConfig.sh' 
1

There are 1 answers

3
Some programmer dude On BEST ANSWER

You need to do it in two steps, and apparently use single-quotes as well:

tempvar='#!/bin/bash\necho configvalue'
alias createConfiger='echo -e "$tempvar" > printConfig.sh'