Creating and Executing a script of aliases in AIX


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Creating and Executing a script of aliases in AIX
# 1  
Old 09-15-2009
Creating and Executing a script of aliases in AIX

hi, I am trying to create a script in AIX (5.3 I think), then run it. here's what I have:

[me@compy] /home/me $ vi first.aliases
...
alias cdblah='cd /blah'
alias cdho='cd /ho'
alias ssr='sudo su - random'
~

...end of first.aliases
[me@compy] /home/me $ ./first.aliases
[me@compy] /home/me $ ssr
ksh: ssr: not found.

[me@compy] /home/me $ alias ssr='sudo su - random'
[me@compy] /home/me $ ssr
[YOU HAVE NEW MAIL]
[random@compy] /home/random $[COLOR="#738fbf"]

---------- Post updated at 03:56 PM ---------- Previous update was at 03:40 PM ----------

. ./first.aliases
is how I have to run the file in order for it to work, but when I switch users, the aliases don't stick.

any idea how to fix that? maybe make it run on start-up for all users? maybe put it in /.profile ?
# 2  
Old 09-15-2009
yup put them in .profile of all users...
# 3  
Old 09-16-2009
Where do I put them in .profile?

The only time I can get them to work is if I leave a quote off the last alias, but that makes my profile not boot properly.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Initialize aliases during shell script execution

Hello, I am trying to run a shell script that tests the connectivity to all the sftp servers and email if any one of them is down. There are aliases for all the servers with sftp command prefix in a '.alias' file. But when I use the alias name to run it as a command in my shell script to test... (3 Replies)
Discussion started by: Dippu
3 Replies

2. Shell Programming and Scripting

Creating a Continuous File Reading-Executing Shell Script

I need to write something that will read and execute all the files(Mainly executable scripts) inside one or more folders; in other words, a continuous chain with a break when finished. I'm new to shell and need syntax help. I'm on Ubuntu 12.10-Gnome btw. Here are some main highlights I think... (2 Replies)
Discussion started by: linuxlololol
2 Replies

3. Shell Programming and Scripting

executing aliases from a file

hi there, i've got this alias i want assign only sometimes, and then work in the same shell with it (so when closing the shell the alias dissapears). As the alias is long, i want it to be in a executable file, so i just execute the script from a terminal and then i can access the alias from that... (4 Replies)
Discussion started by: didgewind
4 Replies

4. Shell Programming and Scripting

Error while executing disk space script in AIX

#!/bin/ksh for AIX used=0 mount=${1:-"/mountpoint"} threshold=${2:-80} #message="hello" #SUBJECT="Disk Space Alert" #EMAIL="xyz@abcinc.com" used=`df -k $mount | grep % | awk '{print $5}' | sed 's/%//g'` #echo "Free Space available under \"$mount\" is `expr 100 - $used`%.\n">$message ... (6 Replies)
Discussion started by: rajeshw61
6 Replies

5. 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

6. 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

7. Shell Programming and Scripting

execution of aliases from shell script

Hi I have to execute the commands in .aliases file from a shell script I tried 1.giving the alias directly in shell script 2.Giving the actually "value of alias" in the shell script 3. I tried giving both steps 1 and 2 inside ` quotes Still nothing is working . It says command... (3 Replies)
Discussion started by: ssuresh1999
3 Replies

8. Shell Programming and Scripting

Accessing aliases within a shell script

I am not able to access the aliases in my environment within a Python script. If I pass the alias to os.system(), I get a message saying "sh: x: not found". I've tried sourcing my .bashrc file in the script, but this does not work. I would perfer not to source my or any rc file because this... (9 Replies)
Discussion started by: cooldude
9 Replies

9. AIX

script for creating aix user

Hi Guys, I want to create user with a script: user name, user id, primary group, group set, home directory, initial program, password, user information, another user can SU to user. And all the rest is the default. Does anyone already have the script for this? Can you please share it... (8 Replies)
Discussion started by: itik
8 Replies

10. UNIX for Dummies Questions & Answers

[AIX] executing script

Hello! I need to run a script from the root user as the other user. I know that I can issue the following command: su - user_name -c "/path_to_script/script_name.sh" But there is a small problem with the above command. I must export a environment variable before I run the script. In the... (1 Reply)
Discussion started by: piooooter
1 Replies
Login or Register to Ask a Question