So I recently showed my friend the wall
command. Now he keeps using it to talk and I regret showing him. I want to make an alias call wall
to keep him from using it and to also prank him. I did alias wall="ls"
for now. It works if the user just types wall
, but if I type wall Hello world
it functions like a regular wall
command. Is there a way where I can get the alias to capture user input and ignore that? so when he types wall hello world
it will still function as ls
?
2 Answers
Functions can take precedence over aliases and commands. You can define function in his .bashrc that will take arguments but just ignore them.
Like so
wall(){ echo " just another brick in the wall " }
OK, so do these things:
sudo echo "PATH=~/.bin:$PATH" >> /home/[username]/.bashrc
sudo mkdir /home/[username]/.bin/
sudo echo "fortune | cowsay # Or whatever command you want to run" > /home/[username]/.bin/wall
sudo chmod 755 /home/[username]/.bin/wall
That way, whenever [username]
runs the command wall
he'll get the output of fortune | cowsay
. Not an alias, but good enough.
fortune | cowsay
(though of course you will have to install both of those packages first)! ;D