Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

When I type:

$ ./somescript.sh <file-script-test> wa-foo-go`

I want it to change that automatically so that it thinks I typed:

$ ./somescript.sh <file-script-test> smart_wa_foo_go 

Or others like bk-bar-rr turning into smart_bk_bar_rr

All are in the same format of xx-xxx-xx and all need the smart_xx_xxx_xx "conversion"

I just don't want to type it all out every time I run this somescript.sh

share|improve this question
# define a wrapper:
$ myfun() { ./somescript.sh "$1" "smart_${2//-/_}"; }

# call it
$ myfun file-script-test wa-foo-go
share|improve this answer

In the script you could modify the argument name

filename="smart_"$1
... operate on $filename
share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .