Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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

2 Answers 2

# 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

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.