Cygwin: Can I automatically change wa-foo-go to smart_wa_foo_go by only typing wa-foo-go?

0

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

Matt

Posted 2012-03-16T14:07:25.470

Reputation: 834

Answers

2

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

# call it
$ myfun file-script-test wa-foo-go

kev

Posted 2012-03-16T14:07:25.470

Reputation: 9 972

1

In the script you could modify the argument name

filename="smart_"$1
... operate on $filename

Scott C Wilson

Posted 2012-03-16T14:07:25.470

Reputation: 2 210