Mailinglist Archive: opensuse (1986 mails)

< Previous Next >
Re: [opensuse] .bashrc alias - One Liner Problem?
  • From: Anders Johansson <ajohansson@xxxxxxx>
  • Date: Sun, 30 Nov 2008 22:51:43 +0100
  • Message-id: <200811302251.43686.ajohansson@xxxxxxx>
On Sunday 30 November 2008 21:07:51 David C. Rankin wrote:
alias wp='if [[ $1 ]]; then webpin $1; else echo -e "\n\tusage: wp
<filename>\n"; fi'


I don't think you can actually pass parameters to aliases. Your previous alias
worked because wp expanded to "webpin $1" and $1 evaluated to the blank string

You want to use a shell function instead. Something like

function wp() { if [ -n "$1" ]; then webpin $1; else echo -e "\nbad usage\n";
fi }

Anders
--
To unsubscribe, e-mail: opensuse+unsubscribe@xxxxxxxxxxxx
For additional commands, e-mail: opensuse+help@xxxxxxxxxxxx

< Previous Next >
References