Skip to main content

All Questions

Tagged with
0 votes
2 answers
60 views

How to expand a Bash alias given as an argument?

I probably approach this problem wrong. I update my Linux machines with bash aliases like: alias upg-pi='\ssh -c [email protected] -C -i $ssh_identity -o ConnectTimeout=$ssh_timeout root@$...
Vlastimil Burián's user avatar
0 votes
2 answers
66 views

append newline to bash alias

Im finding great difficulty in adding a new line character to my bash alias in my ~/.bashrc file alias mip="curl ifconfig.me/ip" I want a newline to be inserted after the above script, so ...
Rachel1983's user avatar
0 votes
1 answer
53 views

zsh, .bash_profile, and aliases

I have a script downloaded from the Internet, the beginning of which looks like this: echo "alias myip='curl -s https://api.ipify.org/'" >> ~/.bash_profile echo "alias myiplookup='...
jsx97's user avatar
  • 1,347
0 votes
0 answers
21 views

Understanding syntax of output from alias [duplicate]

I don't understand how to read the string and the escaping of the following output from listing aliases > alias foo="echo 'hello'" > alias ... alias foo='echo '\''hello'\''' ... It ...
hl5619's user avatar
  • 1
0 votes
2 answers
88 views

Bash - get file count

I have the following alias defined in my .bashrc alias lsfc='ls -l "$@" | tee /dev/tty | grep -v / | echo "File count: `wc -l`"' which is intended to give me the number of ...
David Shaw's user avatar
-1 votes
1 answer
156 views

Override tr in ~/.bashrc

I'm trying to create a function to translate words via a custom script: function mean() { ~/scripts/translate.sh $1 } I would prefer the function to be named tr, as it is much shorter and faster ...
algonell's user avatar
3 votes
1 answer
248 views

How to overload / customize bash (or any other shell) commands handler?

When in bash some non existing command is run, corresponding error message appears: $ non-existent-command non-existent-command: command not found Is it possible to customize this behavior? I would ...
Anton Samokat's user avatar
0 votes
2 answers
150 views

How to write an alias or bash script that renames a single file using the same syntax as the `ren` command of Windows?

I am a long-term a Windows user, so I find the syntax of the ren command both simple and convenient: ren C:\pathTo\myFile\oldFileName.txt newFileName.txt [Update 24 July 2024] To be clear about my ...
ps.pf's user avatar
  • 3
4 votes
1 answer
1k views

Are there alternatives to alias I'm not aware of?

Today I started to notice weird behavior running a local command for a binary installed through Go. It seems the command is aliased, but consulting alias, it isn't. The command buf somehow executes cp!...
Tim's user avatar
  • 1,094
2 votes
0 answers
47 views

Can't unalias then redefine as a function in the same conditional [duplicate]

Here is a simplified implementation of an issue in my bash/zsh aliases file: alias foobar='echo bar' # this is out of my control if true; then unalias foobar echo we got inside the conditional ...
Adam Katz's user avatar
  • 4,132
0 votes
2 answers
135 views

Is it possible to use a command with an argument to trigger a bash alias?

I have a program that tries to trigger a screenlock using the following commands: xdg-screensaver lock xscreensaver -lock cinnamon-screensaver-command --lock The problem is that I'm using ...
guttermonk's user avatar
0 votes
1 answer
71 views

Is there a way I can use .bash_aliases in a shell-scripts? [duplicate]

Is there a way I can use bash aliases from my .bash_aliases file within a shell-scripts? I thought of something like including source "$HOME/.bash_aliases into my script but it does not work.
nath's user avatar
  • 6,074
0 votes
1 answer
183 views

Can I reprogram the pwd command to add a trailing slash?

WHen I use the pwd command, it prints e.g /opt instead of /opt/. I would like it to print the trailing slash. However, I tried adding the following line to my ~/.bash_aliases file: alias pwd=" ...
K.defaoite's user avatar
1 vote
2 answers
620 views

alias defined in .zshrc does not propagate to shell script

I have python installed on my system as python3. In my .zshrc file I defined following alias: alias python=python3 With this, I am able to run python3 using python on the command-line: $ python ...
morpheus's user avatar
  • 135
0 votes
1 answer
404 views

How to show help for some bash command in less (like man do) rather than print it to console

For example, there is no manual pages for trap command. Running: man trap will give: No manual entry for trap Running: trap --help will print help straight to bash console without using less like ...
Anton Samokat's user avatar

15 30 50 per page
1
2 3 4 5
32