On 12/10/15 00:12, Gary R. Schmidt wrote: > On 10/12/2015 6:59 AM, Winnux wrote: >> I have found a few users suggesting that echo "list clients" | bconsole is >> an ideal way to pass a command into bconsole and get the results to shell. I >> found this very useful at times, particularly when issuing the messages >> command as they scroll much slower in bconsole than in shell. >> >> issuing the command with the | in it is not convenient or fast when typing, >> so I wanted to create an alias to handle this. The problem was that the pipe >> '|' would break the alias command as normally written. >> >> Placing the following text into your .bashrc file will create the function >> BconCommand and alias it to bcon, which will allow you to pass in quote >> encapsulated commands to bconsole and get the results back to your ssh >> terminal a little faster and easier. >> >> >> alias bcon=BconCommand >> function BconCommand() >> { >> echo $1 | bconsole >> } >> >> >> usage: >> bcon 'list clients' >> bcon 'list jobs' >> bcon 'list jobid=2551' >> > Why didn't you just do: > $ function bcon > { > echo $* | bconsole > } > > Which means it's just: > $ bcon list media > $ bcon status dir > etcetera.
I was going to say the same thing. Why get an alias involved just to add a layer of abstraction when one isn't needed? Also remember that you will need to export the function: function bcon { echo $* | bconsole } export -f bcon Is your alias possibly because your function was *not* exported? In which case, don't do a hacky workaround for what you didn't do, just export it properly in the first place. -- Phil Stracchino Babylon Communications ph...@caerllewys.net p...@co.ordinate.org Landline: 603.293.8485 ------------------------------------------------------------------------------ _______________________________________________ Bacula-users mailing list Bacula-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/bacula-users