I have this function:
find () {
case "$1" in
package)
pacman -Ss
;;
file)
echo "Find file"
;;
*)
echo "You cannot find something like this."
;;
esac
}
My goal is to be able to do simething like find package foo
. However it looks like the the foo
is not passed as argument to pacman. How can I fix that?
This is what you need then. Try this:
find () { case "$1" in package) shift pacman -Ss $@ ;; file) echo "Find file" ;; *) echo "You cannot find something like this." ;; esac }