Re: alias in bash script issue
Le 3/4/23 à 09:22, Ken Young a écrit :
Hello,
Hi Ken!
3) the content of bash script
$ cat get.sh
#!/bin/bash
source ~/.bash_profile
k get node
4) alias can't work
$ ./get.sh
./get.sh: line 5: k: command not found
Two options :
1. either use #!/bin/bash -i as your shebang.
The -i will automatically enable aliases
(they are disabled by default in non-interactive scripts)
2. or use shopt -s expand_aliases in your script,
like so :
$ cat get.sh
#!/bin/bash
shopt -s expand_aliases
source ~/.bash_profile
k get node
$
See what works best for you.
Best,
--
yassine -- sysadm
+213-779 06 06 23
http://about.me/ychaouche
Looking for side gigs.
Reply to: