On Mon, Jan 17, 2022 at 08:13:58PM -0800, pe...@easthope.ca wrote: > This shell function is defined in .bashrc and used to start firefox. > > fire () { case $# in > 0) /usr/bin/firefox-esr --display=:0 file:///home/peter/MY/Peter.html#Links > & ;; > 1) /usr/bin/firefox-esr --display=:0 $1 & ;; > *) echo "Too many arguments." ;; esac }
"$1" should be quoted there, and the } will need to be on a separate line, or else you'll need a semicolon between esac and }. I'd also advise against hard-coding paths like /usr/bin/firefox-esr in your dot files. Paths can change over time. Just use firefox-esr. > This might be better. > alias fire='exec /usr/bin/firefox-esr --display=:0 "$@"' Bash aliases don't take positional parameters like that. Also, you wouldn't want "exec" here -- running this alias would terminate the shell. Since bash aliases don't take positional parameters, there's really no way to do the background thing with arguments using an alias. So, stick with the function here. As the bash(1) manual says, There is no mechanism for using arguments in the replacement text. If arguments are needed, a shell function should be used (see FUNCTIONS below). And, For almost every purpose, aliases are superseded by shell functions.