SlackwareThis Forum is for the discussion of Slackware Linux.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
which does work. source_file.txt gets formatted, wrapped at 72 chars. per line.
So my question is: Is there a way to get the working command into an alias that works? All of my existing alias on the right of the = begins with ' and ends with '
examples aliases that works:
alias adf='df --human-readable'
alias cmx='chmod u+x'
well the $* part doesn't make sense. as you can see in your correct examples, "cmx" doesn't alias to "chmod u+x $*" does it? that might be all you need, if not, you should be able to escape any nasties with a leading \ but if you just run the alias command without any options it'll show you the current alias so you can see if any synax issues have arisen during the alias assignment.
BTW the $* likely may be a Perl special variable so that the junk.txt parameter on the command line provides_ability/is what the Perl command then runs on the file junk.txt
Distribution: Slackware 11.0; Kubuntu 6.06; OpenBSD 4.0; OS X 10.4.10
Posts: 345
Rep:
Quote:
Originally Posted by acummings
BTW the $* likely may be a Perl special variable so that the junk.txt parameter on the command line provides_ability/is what the Perl command then runs on the file junk.txt
$* in bash contains the current argument list. So, if you pass fmt junk.txt as its argument, $* is junk.txt. I believe perl continued the use of this convention.
Somewhere (I think in the O'Reilly bash book), it says, "$* contains the current argument list. By itself, $* is equivalent to $1, $2, and so on up to the number of arguments. The construct "$*" is equivalent to "$1, $2, ..." which glues all the arguments into a single argument."
$* in bash contains the current argument list. <snip> I believe perl continued the use of this convention.
Oh, OK, I get it now. Since is using a bash shell, that is the bash argument list that is passed to Perl in this case.
It's a "command liner" Perl script (meant to be run from the command line -- in a shell, bash in this case).
That's not Perl's argument list. @ARGV is Perl's argument list. Do a www search for: @ARGV
For instance, a different case scenario: if we have a Perl script and in a shell we call_up/execute that Perl_file/script and also at the same time in the shell, call_up/pass an argument list of files then this argument list goes into Perl's @ARGV
Now, whether or not bash's $* gets used in this latter to pass to Perl's @ARGV, I don't know.
But in a Perl file (shebang line: #!/usr/bin/perl) $* I've not ever seen used. Here it is @ARGV
But of course the shell can be used to execute just such a Perl file as well as pass args to the Perl_file/script. But in this case, Perl's argument list is @ARGV
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.