Linked Questions

1
vote
1answer
270 views

Add aliases to .sh files [duplicate]

For some reason, I had to add an alias to my bash. I have added the alias in /root/.bashrc which also contains the following piece of code: # Source global definitions if [ -f /etc/bashrc ]; then ...
-4
votes
1answer
184 views

How can I pass aliases from a shell to a script run by it? [duplicate]

$ alias alias alert='notify-send --urgency=low -i "$([ $? = 0 ] && echo terminal || echo error)" "$(history|tail -n1|sed -e '\''s/^\s*[0-9]\+\s*//;s/[;&|]\s*alert$//'\'')"' alias egrep='...
0
votes
0answers
92 views

alias defined in modulefile does not work in launched shell [duplicate]

I am trying to get aliases working on my company's number crunching machine, which uses the bash shell on CentOS 7. For software management, we use GNU modules. Some case set-ups for certain ...
0
votes
0answers
25 views

Bash alias defined in script not working within the script [duplicate]

I found a weird thing: When I do in the console, alias a='echo aaa' a I get the output aaa as expected. But when I do a script, let's name it script.sh #!/bin/bash alias a='echo aaa' a and run it ...
5
votes
5answers
4k views

Can't use alias in script, even if I define it just above!

I have a very wierd case... If I run a script with /bin/bash, it can't recognize aliases that I set even inside the script. And the most strange thing is $ cat -n test.sh 1 #!/bin/bash 2 ...
9
votes
6answers
4k views

How can I get sudo commands to use the settings in /root/.bashrc

I have customised .bashrc with a number of alias, specifically ll and export LS_OPTIONS='--color=auto' Unfortunately this does not work when used with sudo, so I also modified /root/.bashrc, but this ...
7
votes
2answers
592 views

bash aliases do not expand even with shopt expand_aliases

I want to run an alias inside a bash -c construct. The bash manual says: Aliases are not expanded when the shell is not interactive, unless the expand_aliases shell option is set using shopt In ...
8
votes
3answers
10k views

Can I make scripts use aliases instead of commands?

I have an alias for a command (I'm setting up a Python development environment) alias python=~/virtualenv/bin/python so that I can run ~/virtualenv/bin/python by just typing python. Now in my ...
3
votes
6answers
476 views

search a command in PATH with the same name of the script

For example, my script is $HOME/bin/sudo. I'd like to search for an executable in $PATH with the same name, sudo, and run it - but not the script $HOME/bin/sudo itself, otherwise I will run into an ...
1
vote
1answer
975 views

how does CentOS load bash_alias file?

I'm used to Ubuntu, where I just create a .bash_aliases file and away you go. In CentOS, how do I get .bashrc to load the .bash_aliases file?
0
votes
1answer
459 views

make custom commands on android 4.4.2

I want to program and debug in my android phone. To do that I downloaded c4droid and it's gcc plugin. after a lot of tries I understood that gcc is in directory /data/data/com.n0n3m4.droidc/files/gcc/...
0
votes
1answer
147 views

safe way to add aliases for another user?

At work I have a personal account, but I'm doing development on a program which is run by a machine account. By "machine account" I just mean that it isn't tied to a person - it doesn't have any ...