0

I made a basic bash script piping fortune and cowsay to make a wise cow, and titled it appropriately as wisecow Is there a way I can enable the flags associated with cowsay so that I can input

wisecow -s

and get the stoner cow, or -b for the borg cow, or what have you?

Currently when I do

wisecow -d

or whatever, the cow looks the same as if I hadn't used the flag

the code lol:

#!/bin/bash
fortune | cowsay
gwyns
  • 3

1 Answers1

2

You give some option to your script, but you never pass it on to cowsay.

To do that, use

fortune | cowsay "$@"

in your script. The "$@" will expand to the list of command line arguments that your script was given, for example the option -d, if that was what you invoked your script with.

Kusalananda
  • 333,661