Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.debian.user > #255650
| From | Yassine Chaouche <a.chaouche@algerian-radio.dz> |
|---|---|
| Newsgroups | linux.debian.user |
| Subject | Re: alias in bash script issue |
| Date | 2023-03-06 11:10 +0100 |
| Message-ID | <G6fX3-aw50-7@gated-at.bofh.it> (permalink) |
| References | <G5vAR-9YKb-3@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
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.
Back to linux.debian.user | Previous | Next — Previous in thread | Find similar | Unroll thread
alias in bash script issue Ken Young <ken@highwinds.cloud> - 2023-03-04 09:40 +0100
Re: alias in bash script issue David <bouncingcats@gmail.com> - 2023-03-04 11:00 +0100
Re: alias in bash script issue Tom Furie <tom@furie.org.uk> - 2023-03-04 14:20 +0100
Re: alias in bash script issue David <bouncingcats@gmail.com> - 2023-03-04 15:50 +0100
Re: alias in bash script issue Greg Wooledge <greg@wooledge.org> - 2023-03-04 17:30 +0100
Re: alias in bash script issue David Wright <deblis@lionunicorn.co.uk> - 2023-03-04 18:20 +0100
Re: alias in bash script issue Greg Wooledge <greg@wooledge.org> - 2023-03-04 18:30 +0100
Re: alias in bash script issue David Wright <deblis@lionunicorn.co.uk> - 2023-03-05 21:40 +0100
Re: alias in bash script issue Greg Wooledge <greg@wooledge.org> - 2023-03-05 22:40 +0100
Re: alias in bash script issue David Wright <deblis@lionunicorn.co.uk> - 2023-03-07 03:50 +0100
Re: alias in bash script issue Ken Young <ken@highwinds.cloud> - 2023-03-05 02:30 +0100
Re: alias in bash script issue Greg Wooledge <greg@wooledge.org> - 2023-03-05 02:40 +0100
Re: alias in bash script issue Tom Browder <tom.browder@gmail.com> - 2023-03-05 12:30 +0100
Re: alias in bash script issue Ken Young <ken@highwinds.cloud> - 2023-03-05 12:40 +0100
Re: alias in bash script issue Tom Browder <tom.browder@gmail.com> - 2023-03-05 12:50 +0100
Re: alias in bash script issue Nicolas George <george@nsup.org> - 2023-03-05 14:30 +0100
Re: alias in bash script issue <tomas@tuxteam.de> - 2023-03-05 17:10 +0100
Re: alias in bash script issue Tom Browder <tom.browder@gmail.com> - 2023-03-07 13:10 +0100
Re: alias in bash script issue <tomas@tuxteam.de> - 2023-03-05 14:10 +0100
Re: alias in bash script issue Yassine Chaouche <a.chaouche@algerian-radio.dz> - 2023-03-06 11:10 +0100
csiph-web