3

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
  • If you get it working a better prank I think would be to get it to run fortune | cowsay (though of course you will have to install both of those packages first)! ;D
    – user364819
    Mar 21, 2016 at 21:18
  • Give me a minute to finish this deathmatch and I'll answer
    – Daniel
    Mar 21, 2016 at 21:30

2 Answers 2

0

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 "  }
0

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.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .