1

I can create an alias in solaris as below:

alias x86 "some_command"

I need something that i can pass an argument to an alias and that argument will be used to frame the complete alias. for example:

there is a command like :

ct setview 1.0_myname

and for the above i write the alias as

alias sv "ct setview 1.0_myname"

in the above command 1.0 is the version and it can keep changing.

so what i want is to create an alias like :

alias sv "ct steview $1_myname"#well i donno whether this is correct

and i want to use this alias as sv 1.0 or sv 2.0

Vijay
  • 65,327
  • 90
  • 227
  • 319

2 Answers2

1

If you are using bash (or equivalent shell), the alias function cannot transmit arguments. Instead, you can create a function :

sv() { ct "setview $@_myname" ;}

And use it like an alias (sv 1.0)

Depending on your config you may need to provide full path of the ct binary

pistache
  • 5,782
  • 1
  • 29
  • 50
0

For csh & tcsh shells, there's limited argument substitution in aliases, using ! syntax, such as:

 alias sv 'ct steview \!:1_myname'

More details and examples at:

alanc
  • 4,102
  • 21
  • 24