Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

Re: How to execute alias commands (source your profile)

by Anonymous Monk
on Jan 13, 2014 at 23:13 UTC ( [id://1070490]=note: print w/replies, xml ) Need Help??


in reply to How to execute alias commands

From what I understand, shell aliases are in-memory stuff like %ENV vars -- so the reason you can't execute them is because they aren't defined

So the solution is to source your profile some how, or a better idea

is to turn all your aliases into shell scripts, say add ~/mybin to your path where you have "myalias" which is a shell script (and not an alias), then as long as ~/mybin is in your path you don't need to source .profile... to load your aliases

  • Comment on Re: How to execute alias commands (source your profile)

Replies are listed 'Best First'.
Re^2: How to execute alias commands (source your profile)
by nanophd (Novice) on Jan 14, 2014 at 15:42 UTC
    Thank you for the reply. I liked the idea of using shell scripts as aliases. I've added /mybin to my path and I am able to execute the script successfully with argument values from the command line. However, when I execute it with perl, the argv values do not get passed.
    if($input eq "-c"){ print "Enter Command: "; my $cmd = <STDIN>; chomp($cmd); print $fh $cmd; print $fh "\n\t#### START COMMAND OUTPUT ####\n"; print `$cmd`; foreach(`$cmd`){ print $fh "#".$_; } print $fh "\t#### END COMMAND OUTPUT ####\n"; next; }
    Shell Script:
    #!/bin/bash perl /path/to/script/script.pl $1 $2 $3 $4
    Any suggestions?
      Never mind. I fell victim of my own stupidity. I was editing the wrong version of the script. Everything seems to be working perfectly.

      Thank you again!

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1070490]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others chilling in the Monastery: (3)
As of 2024-03-29 15:43 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found