10-07-2010
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 way to do this
Here is ex of what i am trying to do
#!/bin/sh
ll | grep -i firstar | awk '{print $3}'
Thanks,
Firestar
10 More Discussions You Might Find Interesting
1. Programming
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
2. UNIX for Dummies Questions & Answers
Is there a way to view what aliases are running on a given session? (1 Reply)
Discussion started by: BG_JrAdmin
1 Replies
3. Programming
hi,
i created some IP aliases, but the only way i can c the aliases is using ifconfgi.. is there any other system command i can use to access the aliased ip list? i tried gng to /proc/net/aliases.. but i don`t have aliases in /proc/net .
Also.. is there ayway i can retireve it using... (2 Replies)
Discussion started by: caltiger
2 Replies
4. Shell Programming and Scripting
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
5. Shell Programming and Scripting
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. Shell Programming and Scripting
hi, I am trying to create a script in AIX (5.3 I think), then run it. here's what I have:
/home/me $ vi first.aliases
...
alias cdblah='cd /blah'
alias cdho='cd /ho'
alias ssr='sudo su - random'
~
...end of first.aliases
/home/me $ ./first.aliases
/home/me $ ssr
ksh: ssr: not found.... (2 Replies)
Discussion started by: heetertc
2 Replies
7. Shell Programming and Scripting
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
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
9. Shell Programming and Scripting
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
10. Shell Programming and Scripting
i have defined a function ln_s() for customizing the ln command in script1.sh.
more script1.sh
echo "Starting Execution"
./script2.sh
echo "End of Execution"
ln_s(){
] && return
ln -s "$1" "$2"
}
My script1.sh executes another script2.sh which has the following entry
more script2.sh... (12 Replies)
Discussion started by: mohtashims
12 Replies
ALI(1) [nmh-1.5] ALI(1)
NAME
ali - list mail aliases
SYNOPSIS
ali [-alias aliasfile] [-list | -nolist] [-normalize | -nonormalize] [-user | -nouser] [-version] [-help] [aliases ...]
DESCRIPTION
Ali searches the named mail alias files for each of the given aliases. It creates a list of addresses for those aliases, and writes that
list on standard output. If no arguments are given, ali outputs all alias entries.
By default, when an aliases expands to multiple addresses, the addresses are separated by commas and printed on as few lines as possible.
If the -list option is specified, then when an address expands to multiple addresses, each address will appear on a separate line.
The switch -user directs ali to perform its processing in an inverted fashion: instead of listing the addresses that each given alias
expands to, ali will list the aliases that expand to each given address. If the -normalize switch is given, ali will try to track down the
official hostname of the address.
The files specified by the profile entry "Aliasfile" and any additional alias files given by the -alias aliasfile switch will be read.
Each alias is processed as described in mh-alias(5).
FILES
$HOME/.mh_profile The user profile
/etc/passwd List of users
/etc/group List of groups
PROFILE COMPONENTS
Path: To determine the user's nmh directory
Aliasfile: For a default alias file
SEE ALSO
mh-alias(5)
DEFAULTS
`aliasfiles' defaults to /etc/nmh/MailAliases
`-nolist'
`-nonormalize'
`-nouser'
CONTEXT
None
BUGS
The -user option with -nonormalize is not entirely accurate, as it does not replace local nicknames for hosts with their official site
names.
MH.6.8 11 June 2012 ALI(1)