Sponsored Content
Top Forums Shell Programming and Scripting [SOLVED] how to use my aliases in a bash script Post 302475636 by xib.be on Monday 29th of November 2010 03:46:47 PM
Old 11-29-2010
[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
Code:
shopt -s expand_aliases

to my script ... but it didn't work.
Later I've read I had to add this at the begning of my my script :
Code:
. ~/.bash_aliases

(of course my aliases are in this file)
but again, the alias command is not found in my script ...

any helps would be welcome.

(please avoid saying I shouldn't use aliases in scripts ... I KNOW IT Smilie )

---------- Post updated at 09:46 PM ---------- Previous update was at 04:52 PM ----------

ok I found my mistake... it was because I used an alias in a variable ... and this doesn't simply work in bash ...

Last edited by xib.be; 11-29-2010 at 04:48 PM.. Reason: solved
 

10 More Discussions You Might Find Interesting

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

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

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

4. Shell Programming and Scripting

bash aliases and command chaining with ; (semi-colon)

What am I doing wrong here? Or is this not possible? A bug? alias f='find . >found 2>/dev/null &' f ; sleep 20 ; ls -l -bash: syntax error near unexpected token `;' (2 Replies)
Discussion started by: star_man
2 Replies

5. Shell Programming and Scripting

[Solved] Output in bash script not captured in variable

I'm tring to write down a simple script that would execute a command and wait until it returns a specific result. This is what i did: bjobs_out=`bjobs` while ]; do bjobs_out=`bjobs` sleep 6 done It seems to work until the command 'jobs' return the list of jobs in execution, but... (4 Replies)
Discussion started by: lifedj
4 Replies

6. Shell Programming and Scripting

[Solved] Using SSH in bash script

Hello, I am writing a script that has to log in to X number of servers over a full C class range. I am only keyed on a certain number of these servers and this can change from time to time. The part of my script that deals with this is for i in $(cat $server_list); do ssh ... (0 Replies)
Discussion started by: colinireland
0 Replies

7. HP-UX

[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 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... (7 Replies)
Discussion started by: leo_ultra_leo
7 Replies

8. Shell Programming and Scripting

[Solved] Unable to call a python script from bash

Hi, I am trying to run a python script embedded in bash script. But is throwing me an error. Please help. Script: #!/bin/bash nohup /usr/bin/python /opt/web/http.py & Error: /usr/bin/python: can't open file '/opt/web/http.py': No such file or directory Please help me on this. (6 Replies)
Discussion started by: maddy26615
6 Replies

9. UNIX for Dummies Questions & Answers

[Solved] Grep in bash script

Hi Experts, I'm writing script to find out last files and its modified date - unfortunately am having problem with the below script. Error message: "grep: sales.txt: No such file or directory" #!/bin/bash var=1 var1=`awk '{n++} END {print n}' sales.txt` while ] do prod=$var... (6 Replies)
Discussion started by: parpaa
6 Replies

10. Shell Programming and Scripting

Aliases NOT working inside bash shell script

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
update-canna-dics_dir(8)				      System Manager's Manual					  update-canna-dics_dir(8)

NAME
update-canna-dics_dir - compile dics.dir file SYNOPSIS
DESCRIPTION
update-canna-dics_dir assembles a dics.dir file in the Canna dictionary using one or more alias files found in a subdirectory of /etc/X11/fonts/. It is typically invoked only from the post-installation and post-removal scripts of a package containing fonts (that pro- vide aliases for their names) for the X Window System, but may be invoked at any time to reconstruct fonts.alias files. For each direc- tory, which is either an absolute path to an X font directory or (preferably) simply the last component of its path (such as "75dpi" or "misc"), update-canna-dics_dir will assemble /usr/lib/X11/fonts/directory/fonts.alias from the files found in /etc/X11/fonts/direc- tory/package.alias. This enables multiple packages to provide aliases for fonts in the same directory. No font package actually provides the fonts.alias file in the X font directory itself, so there is no danger of overwriting one package's aliases with those of another. For instance, the two packages "xfonts-base" and "xfonts-cjk" may both install fonts into the directory /usr/lib/X11/fonts/misc. They each place their fonts.alias files in /etc/X11/fonts/misc/xfonts-base.alias and /etc/X11/fonts/misc/xfonts-cjk.alias (respectively). update- canna-dics_dir concatenates these two files (as well as any others that match /etc/X11/fonts/misc/*.alias) into /usr/lib/X11/fonts/misc/fonts.alias. The format for fonts.alias files is given in the mkfontdir(1) manual page. An example of how to use update-canna-dics_dir in package maintainer scripts is provided in the Debian Policy Manual. SEE ALSO
mkfontdir(1) DIAGNOSTICS
update-canna-dics_dir exits with status 1 if its arguments are absent or invalid. BUGS
See <http://bugs.debian.org/canna>. If you wish to report a bug in update-canna-dics_dir, please see /usr/share/doc/debian/bug-report- ing.txt, the bug(1) command, or the reportbug(1) command. AUTHOR
update-canna-dics_dir is written and copyrighted by ISHIKAWA Mutsumi. It is licensed under the GNU GPL, version 2. Debian GNU/Linux 25 August 2001 update-canna-dics_dir(8)
All times are GMT -4. The time now is 06:01 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy