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

Re: alias in bash script issue



On Sat, Mar 04, 2023 at 10:23:24AM +0100, Kamil Jońca wrote:
> Ken Young <ken@highwinds.cloud> 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  allow a string to be substituted for a word
   when it is used as the first word of a simple command.
   [...]

   Aliases are not expanded when the shell is not interactive,
   unless the expand_aliases shell option is set using shopt

I'd recommend reading the whole section. Perhaps what the OP
needs is a shell function, not an alias.

Cheers
-- 
t

Attachment: signature.asc
Description: PGP signature


Reply to: