alias & parameters


 
Thread Tools Search this Thread
Operating Systems HP-UX alias & parameters
# 1  
Old 11-12-2004
Question alias & parameters

We just recently moved from a DG-UX (Unix V) to HP 9000 servers running POSIX. I used the c-shell in the DG-UX system mainly because the bourne-shell did not support aliasing. Now in the default posix-shell of HP aliasing is supported. The main difference seams to be that in a c-shell you can pass the cmd-line arguments to an alias by using '\!*' - this is not the case in the posix-shell (sh-shell). I know I can "pass" arguments to an alias in posix - it gets appended to the aliased cmd, but if your alias (main reason in my opinion) is a complex set of piped cmds then the arguments get again only appended to the last cmd. Is there a way to pass arguments In the sh-shell (posix) similar to "\!*" in the c-shell?

THX in advance for any help! Smilie
# 2  
Old 11-13-2004
The easiest way to do it is to convert your aliases to functions. Then you can do stuff like (this is for ksh, but sh-posix should be similar)

Code:
function somealias
{
    something $1 | something | something $2
}

and call it with "somealias arg_1 arg_2"

Cheers
ZB
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Red Hat

Alias ip & hostname

Hello Forum members, I am new to the Linux administration and i have a question on the below requirement , requirement is as below Create a new alias-IP & alias-Host name to the existing virtual machine ( RHEL 6.6) I have created alias-IP and here is the below eth3 Link... (0 Replies)
Discussion started by: raokl
0 Replies

2. UNIX and Linux Applications

SAP & DB2 Process Monitoring Parameters

What are the parameters ((i.e., Process & Services) need to monitor for SAP & DB2 to capture shutdown, restart & Halt status of those applications. Please suggest the best practices. Ex: SAPSTART for SAP & DP2SYS for DB2 (3 Replies)
Discussion started by: marunmeera
3 Replies

3. Shell Programming and Scripting

Clear command help & alias

Hi Folks, When I type clear on my unix prompt on mac terminal, it prints the help menu of a program instead of cleaning the contents of the screen. Also, I have used the following alias command to setup some shortcuts, but soon after I logout and login, these shortcuts doesn't work. alias... (4 Replies)
Discussion started by: jacobs.smith
4 Replies

4. UNIX for Dummies Questions & Answers

Create alias files (not alias commands)

If one: $ find -name 'some expression' -type f > newfile and then subsequently wants to create an alias file from each pathname the find command retrieved and the > placed within 'newfile', how would one do this? Ideally, the newly created alias files would all be in one directory. I am... (3 Replies)
Discussion started by: Alexander4444
3 Replies

5. Shell Programming and Scripting

PHP read large string & split in multidimensional arrays & assign fieldnames & write into MYSQL

Hi, I hope the title does not scare people to look into this thread but it describes roughly what I'm trying to do. I need a solution in PHP. I'm a programming beginner, so it might be that the approach to solve this, might be easier to solve with an other approach of someone else, so if you... (0 Replies)
Discussion started by: lowmaster
0 Replies

6. AIX

tuning network parameters : parameters not persist after reboot

Hello, On Aix 5.2, we changed the parameters tcp_keepinit, tcp_keepintvl and tcp_keepidle with the no command. tunrestore -R is present in inittab in the directory /etc/tunables we can clearly see the inclusion of parameters during reboot, including the file lastboot.log ... (0 Replies)
Discussion started by: dantares
0 Replies

7. Shell Programming and Scripting

AWK alias with parameters

Hello, How can I make an alias of an AWK one liner that prints specific lines from a file like below? # from a command like this: awk 'NR == 100, NR == 150' file.cfg The alias I want to make should work like this(I guess): <alias_command> <file.cfg><start_line><end_line> So the... (1 Reply)
Discussion started by: majormark
1 Replies

8. Solaris

How to tune kernel Parameters in Solaris 10,9 & how to measure performance

Hi, I want to tune my SUN servers for best performance. My servers are heavily loaded and used. They have Solaris 10. How to tune Kernel Parameters of solaris ? And How can I measue performance before changing parameters and after changing parameters ? Please help Thanks NeeleshG (2 Replies)
Discussion started by: neel.gurjar
2 Replies

9. UNIX for Dummies Questions & Answers

alias for running in background &

Hi all, I am kinda new to this unix environment, and now I get confused to figure out this alias problem. I would like to make my xemacs to run in background every call, and I am trying to do it this way in .bashrc alias e='xemacs &* & ' i also tried e () { xemacs "&*" &} but they are... (0 Replies)
Discussion started by: hfireflyu
0 Replies

10. Shell Programming and Scripting

Alias's & Functions - simple question

Having a memory lapse: If I redefine a command using an alias or a function - How do I access the "real" command without specifying an absoulte path: i.e. function man { /usr/bin/man |more } alias ls='/usr/bin/ls -l' How do I specify the ls or man command above without the... (6 Replies)
Discussion started by: kornshellmaven
6 Replies
Login or Register to Ask a Question