bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: An alias named `done` breaks for loops


From: L A Walsh
Subject: Re: An alias named `done` breaks for loops
Date: Tue, 17 Aug 2021 16:42:46 -0700
User-agent: Thunderbird 2.0.0.24 (Windows/20100228)



On 2021/08/14 17:05, Kerin Millar wrote:
On Sat, 14 Aug 2021 15:59:38 -0700
George Nachman <gnachman@llamas.org> wrote:

This does not constitute a valid test case for two reasons. Firstly, aliases have no effect in scripts unless the expand_aliases shell option is set.
----
1)  I frequently use for loops in an interactive shell to act on arrays.
   Arrays are the easiest way to not have spaces breaking args
i.e.:
2)  I almost always start my scripts with a templated prologue:
----
 cat ~/bash/template
#!/bin/bash -u
# vim=:SetNumberAndWidth
export PS4='>${BASH_SOURCE:+${BASH_SOURCE/$HOME/\~}}#\
${LINENO}${FUNCNAME:+(${FUNCNAME})}> '
shopt -s expand_aliases
alias my='declare ' int='my -i ' array='my -a ' map='my -A '
setx() { trap unsetx EXIT; set -x; } ; unsetx() { set +x;}
################################################################################
## (prog goes here)
# vim: ts=2 sw=2
----






reply via email to

[Prev in Thread] Current Thread [Next in Thread]