Re: alias in bash script issue

2023-03-07 Thread Tom Browder
On Sun, Mar 5, 2023 at 07:20 Nicolas George wrote: ... > Tom Browder (12023-03-05): > > Yes, but please use its new name, Raku. Note new releases come out > monthly > so you shouldn't use the Debian packages since they are way behind. We > have I shouldn't have said "you shouldn't use the Debi

Re: alias in bash script issue

2023-03-06 Thread David Wright
On Sun 05 Mar 2023 at 16:30:10 (-0500), Greg Wooledge wrote: > On Sun, Mar 05, 2023 at 02:37:48PM -0600, David Wright wrote: > > There are many lists of dangerous aliases on the web, but I haven't > > found a list of such aliases that can't be transcribed into functions. > > Here's one document: >

Re: alias in bash script issue

2023-03-06 Thread Yassine Chaouche
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

Re: alias in bash script issue

2023-03-05 Thread Greg Wooledge
On Sun, Mar 05, 2023 at 02:37:48PM -0600, David Wright wrote: > There are many lists of dangerous aliases on the web, but I haven't > found a list of such aliases that can't be transcribed into functions. Here's one document: https://www.chiark.greenend.org.uk/~sgtatham/aliases.html

Re: alias in bash script issue

2023-03-05 Thread David Wright
On Sat 04 Mar 2023 at 12:23:58 (-0500), Greg Wooledge wrote: > On Sat, Mar 04, 2023 at 11:14:39AM -0600, David Wright wrote: > > > This use is discouraged > > > > There's a place for warning about the use of aliases in, say, > > Greg's BashPitfalls, or books, but not here. > > Discouraging th

Re: alias in bash script issue

2023-03-05 Thread tomas
On Sun, Mar 05, 2023 at 02:19:38PM +0100, Nicolas George wrote: > Tom Browder (12023-03-05): > > Yes, but please use its new name, Raku. Note new releases come out monthly > > so you shouldn't use the Debian packages since they are way behind. We have > > a member on the release team who provides D

Re: alias in bash script issue

2023-03-05 Thread Nicolas George
Tom Browder (12023-03-05): > Yes, but please use its new name, Raku. Note new releases come out monthly > so you shouldn't use the Debian packages since they are way behind. We have > a member on the release team who provides Debian packages as "rakudo-pkg" > so apt/aptitude update/upgrade work as

Re: alias in bash script issue

2023-03-05 Thread tomas
On Sun, Mar 05, 2023 at 07:30:18PM +0800, Ken Young wrote: > Is perl6 production ready? Of course. But be aware that it is quite a different language. > I have not used perl for a long time. If you prefer the "old" Perl (I do, for... reasons), it's still being maintained actively, too. Cheers -

Re: alias in bash script issue

2023-03-05 Thread Tom Browder
On Sun, Mar 5, 2023 at 05:30 Ken Young wrote: > Is perl6 production ready? > Yes, but please use its new name, Raku. Note new releases come out monthly so you shouldn't use the Debian packages since they are way behind. We have a member on the release team who provides Debian packages as "rakudo

Re: alias in bash script issue

2023-03-05 Thread Ken Young
Is perl6 production ready? I have not used perl for a long time. Sincerely, Ken Young On Sun, Mar 5, 2023 at 7:28 PM Tom Browder wrote: > My take: > > I use aliases heavily in my shell (bash), but I rarely use bash scripting > at all. > > For any serious scripting, since about 2016 I'ved used

Re: alias in bash script issue

2023-03-05 Thread Tom Browder
My take: I use aliases heavily in my shell (bash), but I rarely use bash scripting at all. For any serious scripting, since about 2016 I'ved used Raku (formerly Perl 6). Before that I used Perl. Both are much easier to use. -Tom

Re: alias in bash script issue

2023-03-04 Thread Greg Wooledge
On Sun, Mar 05, 2023 at 09:26:41AM +0800, Ken Young wrote: > On Sat, Mar 4, 2023 at 5:53 PM David wrote: > > Debian's default shell is 'dash'. Its manual, readable using 'man dash', > > says > my debian 11's default shell is just bash. > > root@nxacloud-bloghost:~# echo $SHELL > > /bin/bash Bo

Re: alias in bash script issue

2023-03-04 Thread Ken Young
On Sat, Mar 4, 2023 at 5:53 PM David wrote: > On Sat, 4 Mar 2023 at 19:30, Ken Young wrote: > > > Do you know why my alias can't work in the bash script? > > The info is as follows. > > > > 1) this alias does exist > > $ alias |grep 'k=' > > alias k='minikube kubectl --' > > > > 2) it also exis

Re: alias in bash script issue

2023-03-04 Thread Greg Wooledge
On Sat, Mar 04, 2023 at 11:14:39AM -0600, David Wright wrote: > > This use is discouraged > > There's a place for warning about the use of aliases in, say, > Greg's BashPitfalls, or books, but not here. Discouraging the use of legacy features that are considered dangerous in modern usage is f

Re: alias in bash script issue

2023-03-04 Thread David Wright
On Sat 04 Mar 2023 at 20:52:15 (+1100), David wrote: > Hi. Friends don't help friends to do bad things :) > > Debian's default shell is 'dash'. Its manual, readable using 'man dash', > says > > Aliases provide a convenient way for naive users to create shorthands > for commands without h

Re: alias in bash script issue

2023-03-04 Thread Greg Wooledge
On Sun, Mar 05, 2023 at 01:39:35AM +1100, David wrote: > I am aware. 'man dash' better describes how aliases should be > used in modern times, ??? Is this the paragraph you mean? Aliases provide a convenient way for naive users to create shorthands for commands without having to learn

Re: alias in bash script issue

2023-03-04 Thread David
On Sun, 5 Mar 2023 at 00:12, Tom Furie wrote: > On Sat, Mar 04, 2023 at 08:52:15PM +1100, David wrote: > > Debian's default shell is 'dash'. Its manual, readable using 'man dash', > > says > > The script explicitly calls bash. The rest of your point is still > (coincidentally) valid though, as it

Re: alias in bash script issue

2023-03-04 Thread Tom Furie
On Sat, Mar 04, 2023 at 08:52:15PM +1100, David wrote: > Debian's default shell is 'dash'. Its manual, readable using 'man dash', > says The script explicitly calls bash. The rest of your point is still (coincidentally) valid though, as it would be in most of the popular shells as far as I'm aware

Re: alias in bash script issue

2023-03-04 Thread David
On Sat, 4 Mar 2023 at 19:30, Ken Young wrote: > Do you know why my alias can't work in the bash script? > The info is as follows. > > 1) this alias does exist > $ alias |grep 'k=' > alias k='minikube kubectl --' > > 2) it also exists in .bash_profile > $ cat ~/.bash_profile |grep 'k=' > alias k=

Re: alias in bash script issue

2023-03-04 Thread tomas
On Sat, Mar 04, 2023 at 10:23:24AM +0100, Kamil Jońca wrote: > Ken Young writes: > [..] > > I am not bash expert (prefer zsh) but as far as I know they are > expadnded during interactive session only, not in scripts. That's at least what the man page says (man bash(1)): ALIASES Aliases allo

Re: alias in bash script issue

2023-03-04 Thread Kamil Jońca
Ken Young writes: [..] I am not bash expert (prefer zsh) but as far as I know they are expadnded during interactive session only, not in scripts. > > $ ./get.sh  > > ./get.sh: line 5: k: command not found > https://www.gnu.org/software/bash/manual/bash.html#Aliases --8<---cut here-

alias in bash script issue

2023-03-04 Thread Ken Young
Hello, Do you know why my alias can't work in the bash script? The info is as follows. 1) this alias does exist $ alias |grep 'k=' alias k='minikube kubectl --' 2) it also exists in .bash_profile $ cat ~/.bash_profile |grep 'k=' alias k="minikube kubectl --" 3) the content of bash script