[Solved] Aliases in HP-UX


 
Thread Tools Search this Thread
Operating Systems HP-UX [Solved] Aliases in HP-UX
# 1  
Old 06-12-2012
[Solved] Aliases in HP-UX

Hi folks,

How can I make an alias in HP-UX? I've tried to add something just like this

Code:
bye='exit'

(as example), the system accepted but when I write bye in the terminal its return with invalid command. When I make such alias in RedHat or Fedora the system accept it right there, what is the right method in adding the Aliases in HP-UX?

Or, where can I find the alias file so can I modify it and add whatever I want of aliases.

Thanks in advance...

Leo

Last edited by leo_ultra_leo; 06-12-2012 at 12:41 PM.. Reason: Add more details...
# 2  
Old 06-12-2012
This mostly isn't OS specific but shell specific. it would be alias bye=exit and placed in .kshrc or .shrc most likely.
# 3  
Old 06-12-2012
You need preceded the assignment with the command alias
Code:
alias bye='exit'

If you are using the default Shell in HP-UX or ksh, place the command in your .profile file .
# 4  
Old 06-17-2012
I'm using sh shell, but I can't find the .profile file in the home directory, even when I (ls) the hidden files via ls -A.
# 5  
Old 06-17-2012
Then you would need to create .profile in your home directory.
# 6  
Old 06-17-2012
The weird thing is that I have many aliases in my system when I run
Code:
alias

command the system list many of per-defined aliases that created by the vendor of the system!
# 7  
Old 06-17-2012
Aliases can also be set in /etc/profile for all users and also, Posix shell has a number of default aliases which can be unset..


From man sh-posix :
Code:
      The following exported aliases are compiled into the shell but can be
      unset or redefined:

           autoload='typeset -fu'
           command='command '
           functions='typeset -f'
           history='fc -l'
           integer='typeset -i'
           local=typeset
           nohup='nohup '
           r='fc -e -'
           stop='kill -STOP'
           suspend='kill -STOP $$'
           type='whence -v'


Last edited by Scrutinizer; 06-17-2012 at 07:09 AM..
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

[SOLVED] how to use my aliases in a bash script

Hi, I confess to be stuck ... as explained here Aliases - Bash Reference Manual I added shopt -s expand_aliasesto my script ... but it didn't work. Later I've read I had to add this at the begning of my my script : . ~/.bash_aliases(of course my aliases are in this file) but again, the... (0 Replies)
Discussion started by: xib.be
0 Replies

2. Shell Programming and Scripting

Using Aliases in a script

Hi all, I have and alias set in .profile like alias ll='ls -la' I am writing a shell script in which i am using "ll" but it gives command not found . Can anyone please tell me how source aliases in the script we write do i need to define it again in every script i write is there any oher... (1 Reply)
Discussion started by: firestar
1 Replies

3. UNIX for Dummies Questions & Answers

Aliases In Unix

Hi, I am new to Unix. I want to know how to setup aliases in Unix. Mean if i write a particular word say scripts then it should take me to scripts directory. Kindly help. (2 Replies)
Discussion started by: amritansur
2 Replies

4. UNIX for Dummies Questions & Answers

Setting aliases

How come if I set an alias as such: alias dt 'date "+%Y-%m-%d %H:%M:%S"' it will work as intended, ie the command 'dt' does prompt the date and time, but not when invoked through a script as such: #!/bin/sh alias dt 'date "+%Y-%m-%d %H:%M:%S"' The OS is FreeBSD 7.1. Thanks in advance (4 Replies)
Discussion started by: figaro
4 Replies

5. Shell Programming and Scripting

etc aliases

Hello: i have several server with own etc aliases. right now i want to combine it all into a general etc aliases in a new freebsd server. cause it consist hundred thousand of record user inside how to make a shell script to combine it or configure it. all etc aliases record example: ... (0 Replies)
Discussion started by: peterLfs
0 Replies

6. UNIX for Dummies Questions & Answers

man aliases

Can any one show me how to create an alias account that silently copies local emails to the administrator (root) using a linux cmd line or GUI? The answer needs to be very simplly explained at this stage, as I am new to the command prompt...expecialy in linux. thanks heaps guys Pipa:) I... (2 Replies)
Discussion started by: Pipa
2 Replies

7. Shell Programming and Scripting

/etc/mail/aliases

HI I have 5000 users on sendmail server, also there entries of these users Mail ID in /etc/mail/aliases as per Diparments. Same Mail ID can occures in Diff Departments as per req. I have to remove 500 users from server also there entry from /etc/mail/aliases file. which occures many times. ... (1 Reply)
Discussion started by: Kumarsharad
1 Replies

8. UNIX for Dummies Questions & Answers

aliases

Is there a way to view what aliases are running on a given session? (1 Reply)
Discussion started by: BG_JrAdmin
1 Replies

9. Programming

aliases

Hi. I have a C program that is using the **environ pointer and I am trying to set up aliases for a system("/bin/ksh") call. This works for other environment variables but not for the aliases. Does anyone know if this can be done? Thanks ahead of time. (1 Reply)
Discussion started by: mluey61
1 Replies

10. UNIX for Dummies Questions & Answers

Sendmail / Aliases

I'm trying to make a script that will automatically read incoming mail, parse the recipient, then send a file off to the recipient. (Name of file = mail.pl) #!/usr/bin/perl $mailDir = "/var/spool/mail/" $user = print `cat <STDIN> | grep To: | cut -b5-`; print `elm -s Awaiting Mail $user <... (1 Reply)
Discussion started by: ComTec
1 Replies
Login or Register to Ask a Question