This is a sample straight forward program. I am using C-shell and want a solution for this environment itself. Following this code sample:
set FILENAME = "\!:2"
alias jo 'echo this is my \!:1 file and its name is $FILENAME'
on command line when I give the following:
jo first sample.txt
I should get the output as
this is my first file and its name is sample.txt
instead I get
this is my first file and its name is !:2
The problem here is the symbol \ totally gets eliminated, I don't know how. That is needed if I want it to take the argument. Can anyone help out with this?
To achieve the desired result, you should wrap the alias' second argument with double quotes, so the variable filename gets interpreted correctly:
Test case: