5

I have an executable that I use often:

/dir1/dir2/dir3/dir4/executable argv[1] argv[2] argv[3]

I know that I can set an alias for the executable:

alias myexecutable = '/dir1/dir2/dir3/dir4/executable'

and then call it

myexecutable argv[1] argv[2] argv[3]

However, I'd like to call it like this

myexecutable argv[1]

because the first argument is the only one that ever changes. The second and third one should always be passed as the same every time.

2

1 Answer 1

6

Aliases don't handle arguments. Define a function:

myfunc () {
    /dir1/dir2/dir3/dir4/executable "$1" fixed-argv2 fixed-argv3
}

You must log in to answer this question.

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