Can't get '$1' to work in a .profile alias

Can't get '$1' to work in a .profile alias

Post by glen » Thu, 20 Mar 2003 01:56:28



Help..
I have an alias set up in my .profile to run a unix script.
I'd like to be able to 'pass' diffent values to the script.

I'm using /bin/sh

Here is the alias in my .profile
alias mycheck="/apps/scripts/file_check fred.txt"

I'd like to be able to pass other values to file_check besides
'fred.txt'.

I've tried  
alias mycheck="/apps/scripts/file_check $1"
but when I run the 'alias' the value passed to file_check is 'vi', I
also tired $2 and the value passed was '-o'.

My confusion... This one works just fine..
alias mytest="ll \$1"

Thanks,
Glenn

 
 
 

Can't get '$1' to work in a .profile alias

Post by William Par » Thu, 20 Mar 2003 02:58:57



> Help..
> I have an alias set up in my .profile to run a unix script.
> I'd like to be able to 'pass' diffent values to the script.

> I'm using /bin/sh

> Here is the alias in my .profile
> alias mycheck="/apps/scripts/file_check fred.txt"

alias mycheck='/apps/scripts/file_check'

--

Linux solution for data management and processing.

 
 
 

Can't get '$1' to work in a .profile alias

Post by Bill Marcu » Thu, 20 Mar 2003 13:51:56


On 18 Mar 2003 08:56:28 -0800, glenn


> Help..
> I have an alias set up in my .profile to run a unix script.
> I'd like to be able to 'pass' diffent values to the script.

> I'm using /bin/sh

Use a function, not an alias.

--
Ever wonder if taxation without representation might have been cheaper?

 
 
 

1. kill -9 `ps -u`whoami` | grep $1 | awk '{print $1}'`

Hi,

Could you help me debugging a simple csh script:
This script is intended to kill a process by just giving its name, e.g.
KILL this_process

I do it like this:

kill -9 `ps -u`whoami` | grep $1 | awk '{print $1}'`

and actually it tries to kill everything (including my term of course)

The following line works fine:

ps -u`whoami` | grep this_process | awk '{print $1}'

and gives the proper PID

If you have a more elaborated script for that It could be a nice training
example for me.

Thanks for any help.

2. nicelevel 20

3. alias RM='mv $1 ~/garbage/'

4. NICs

5. Q: alias psef='ps -ef $1'

6. TEST! ----REPLY----PLEASE----NEED----TO---VERIFY

7. expect script doesn't understand '$1' from command line?

8. Cannot configure X11 and Princeton DPP560

9. How expand the variable inside '$1'?

10. ps -eo pid,args | awk ' /[b]lah/ { print $1 } ' | xargs kill

11. how do 'plug-ins' work?

12. My 'alias' doesnt' work in X windows ??

13. awk -F'[ \t]' '/^ltdbsvr[ \t]'/ { print $1 }' file not working on HP-UX