0

I'm a bit confused on how to modify the function arguements:

I want:

bower ln bower ln thing 

to execute:

bower link bower link thing 

This is as close as I have gotten:

# ~/.bashrc bower () { if [[ $1 == "ln" ]]; then ${@[1]}="link" echo "replacing" "$FUNCNAME" "$@" fi command "$FUNCNAME" "$@" } 
0

1 Answer 1

2

Use the set command:

bower () { if [[ $1 == ln ]]; then set -- link "${@:2}" echo "replacing $FUNCNAME $@" fi command "$FUNCNAME" "$@" } 

However, you don't really have to replace the first argument; you can simply hardcode the correct argument in the body of the if statement:

bower () { if [[ $1 == ln ]]; then echo "replacing $FUNCNAME $first $@" command "$FUNCNAME" link "${@:2}" else command "$FUNCNAME" "$@" fi } 
Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.