Unix Shell - Referencing command line parameters in a shell script

This is Interesting: Free IT Magazines  
Home > Archive > Unix Shell > March 2005 > Referencing command line parameters in a shell script





You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

Author Referencing command line parameters in a shell script
Dave

2005-03-14, 5:57 pm

Hello all,

I have the following one-line shell script:

sed 's/$1/$2/' file.h > file.tmp

For some reason, this does not work. The $1 and $2 variables are not
dereferenced properly. Can anyone point me in the right direction?

Thanks,
Dave


Michael Tosch

2005-03-14, 5:57 pm

Dave wrote:
> Hello all,
>
> I have the following one-line shell script:
>
> sed 's/$1/$2/' file.h > file.tmp
>
> For some reason, this does not work. The $1 and $2 variables are not
> dereferenced properly. Can anyone point me in the right direction?
>
> Thanks,
> Dave
>
>


The shell man page sais that variables are de-referenced within
"quotes" but not within 'quotes'

--
Michael Tosch @ hp : com
Alan Connor

2005-03-14, 5:57 pm

On Mon, 14 Mar 2005 14:07:04 -0700, Dave
<better_cs_now@yahoo.com> wrote:

> Hello all,
>
> I have the following one-line shell script:
>
> sed 's/$1/$2/' file.h > file.tmp
>
> For some reason, this does not work. The $1 and $2 variables
> are not dereferenced properly. Can anyone point me in the
> right direction?
>
> Thanks, Dave
>
>


I just checked http://groups.google.com/advanced_group_search.

It says that "Dave" has posted 847 times in the last month.

That's 28 posts a day.

No wonder you have to ask extremely basic questions like the
above: You don't have time to do any studying. No time to even
read the group here, where your question was answered in the last
24 hours. At least once.

It is regularly answered here, so you haven't bothered to do
_any_ studying on your own.

Would you like us to hold your dick for you when you pee, too?

AC


Dave

2005-03-14, 5:57 pm

"Alan Connor" <zzzzzz@xxx.yyy> wrote in message
news:jjnZd.10761$cN6.8495@newsread1.news.pas.earthlink.net...
> On Mon, 14 Mar 2005 14:07:04 -0700, Dave
> <better_cs_now@yahoo.com> wrote:
>
>
> I just checked http://groups.google.com/advanced_group_search.
>
> It says that "Dave" has posted 847 times in the last month.
>
> That's 28 posts a day.
>
> No wonder you have to ask extremely basic questions like the
> above: You don't have time to do any studying. No time to even
> read the group here, where your question was answered in the last
> 24 hours. At least once.
>
> It is regularly answered here, so you haven't bothered to do
> _any_ studying on your own.
>
> Would you like us to hold your dick for you when you pee, too?
>
> AC
>
>


Pardon me XXXXXXX, but I have posted two or three times to this group in my
*life*. I have never been subscribed to it until last week, and I posted
after poring through my Linux book. How many friggin' Daves do you think
are out there? It's a very common name. God, what a moron. Do you really
think anybody posts "basic" questions that frequently? Now get a friggin'
life and quit being a dick. Plonk.


Cliff Hermes

2005-03-14, 5:57 pm

On Mon, 14 Mar 2005 14:56:02 -0700, Dave
<better_cs_now@yahoo.com> wrote:

> "Alan Connor" <zzzzzz@xxx.yyy> wrote in message
> news:jjnZd.10761$cN6.8495@newsread1.news.pas.earthlink.net...
>
>
>
> Pardon me XXXXXXX, but I have posted two or three times to this
> group in my *life*. I have never been subscribed to it until
> last week, and I posted after poring through my Linux book.


Try man bash, moron. Bash is only one of many applications
covered in a linux book, and they are usually mostly concerned
with installation and configuration. Duh.

And search the archives of comp.unix.shell.

Just googling the question would get you there.

And I didn't say that you had posted to _this_ group 847 times.

Maybe you should take an ESL course?

> How many friggin' Daves do you think are out there? It's a
> very common name. God, what a moron. Do you really think
> anybody posts "basic" questions that frequently? Now get a
> friggin' life and quit being a dick. Plonk.
>
>


Maybe you should choose another alias then? If the one you have
chosen is already being used by a lot of other people?

That way you wouldn't be confused with them.

Duh.

And because you have chosen a common name for an alias, there
is no way to tell whether what you have said above it the
truth, is there?

Duh.



AC

Chris F.A. Johnson

2005-03-14, 5:57 pm

On Mon, 14 Mar 2005 at 22:35 GMT, Cliff Hermes wrote:
> On Mon, 14 Mar 2005 14:56:02 -0700, Dave
><better_cs_now@yahoo.com> wrote:
>

[AC drivel snipped]
[vbcol=seagreen]
> Try man bash, moron.


Who said anyhing about bash?

> Bash is only one of many applications
> covered in a linux book, and they are usually mostly concerned
> with installation and configuration. Duh.


Who said anything about Linux?

> And search the archives of comp.unix.shell.


Or the FAQ.

> Just googling the question would get you there.


True.

[more AC/CH drivel snipped]

> And because you have chosen a common name for an alias, there
> is no way to tell whether what you have said above it the
> truth, is there?


No one else has any difficulty telling the difference.

(Nor any difficulty spotting fake names that work as well as your
killfile.)

PLONK!

--
Chris F.A. Johnson http://cfaj.freeshell.org/shell
========================================
===========================
My code (if any) in this post is copyright 2005, Chris F.A. Johnson
and may be copied under the terms of the GNU General Public License
Dave

2005-03-14, 5:57 pm

"Chris F.A. Johnson" <cfajohnson@gmail.com> wrote:

[reference to using just "Dave" as an alias:]

>
>
> No one else has any difficulty telling the difference.
>


Bullshit. (If changing throway email addresses at yahoo, etc,
or changing newsservers, fools someone, they are very ignorant
and/or stupid, neither description fitting you in the least.)

-----------------------------------------------------------------

I don't care whether you killfile "me" again or not.

When I want to tap your considerable expertise, I just use
my "nice guy" alias and a different newsserver.

And I _do_ appreciate your help.

Dave

Bill Marcum

2005-03-15, 5:59 pm

On Mon, 14 Mar 2005 23:28:30 GMT, Dave
<alam_54a@yahoo.com> wrote:
>
> I don't care whether you killfile "me" again or not.
>
> When I want to tap your considerable expertise, I just use
> my "nice guy" alias and a different newsserver.
>

A few days ago, "Alan" said almost exactly the same thing. I think you
and he are the same person. Go play somewhere else.
Alan Connor

2005-03-15, 5:59 pm

On Tue, 15 Mar 2005 09:54:16 -0500, Bill Marcum
<bmarcum@iglou.com.urgent> wrote:

> On Mon, 14 Mar 2005 23:28:30 GMT, Dave <alam_54a@yahoo.com>
> wrote:
>
>
> A few days ago, "Alan" said almost exactly the same thing. I
> think you and he are the same person.


Thought that was pretty obvious. Meant it to be.

> Go play somewhere else.


Make me. (You couldn't if your life depended on it.)

I wouldn't have to play games like this if people like Chris
FAJ (and now you) weren't so arrogant and unfair

He got out-of-line and I called him on it, and the arrogant
prick just couldn't take it.

So I found a way around him.

Don't like it, Bill?

Then eat shit.

You'll help me when I need help.

I am better at disguising my identity on the Usenet
than any of these trolls that you help all the time.


AC

Kevin Rodgers

2005-03-15, 5:59 pm

Alan Connor wrote:
> You'll help me when I need help.


We're not qualified to give you the kind of help you need, Alan. This
is comp.unix.shell, not alt.psychopath.take-your-meds.

--
Kevin Rodgers
Alan Connor

2005-03-15, 5:59 pm

On Tue, 15 Mar 2005 16:00:18 GMT, Alan Connor <zzzzzz@xxx.yyy> wrote:
>


<snip>

'Kevin Rodger.*': I don't read your posts.

Shut up and get lost, you XXXXing punk.

Done.

Quite some time ago.

You have a troll score in my newsreader, which means that your
posts are stripped of their bodies and non-essential headers
and the Subject is changed to "XXXXXXX" before being sent to
the local news cache I read from.

A *lot* of people read from this cache. They trust me to be
able to weed out the shit. They became fed up with the raw
Usenet a long time ago and will not put up with punks like you.

No. They won't see this post either. XXXXX posts and any posts
of mine that are replies to my own posts go to a local newsgroup
that only I have access to. As well as other posts of mine with
a certain string in them...

Procmail makes a wonderful newsfilter.

AC

B H

2005-03-15, 5:59 pm

Dave skrev:

> Pardon me XXXXXXX, but I have posted two or three times to this group in my


PLEASE. do NOT feed the TROLL
Moshe Jacobson

2005-03-22, 6:08 pm

B H <bernt@bah.homeip.net> wrote:
> PLEASE. do NOT feed the TROLL


Or, as one netizen so nicely put it once:

+--------------+
| PLEASE |
| DO NOT FEED |
| THE TROLL |
| --The Mgt.|
+------++------+
||
o o o || *
,,\|/,,,||,,,/,,,
---+--------------


--
*** SPAM BLOCK: Remove bra before replying! ***
http://runslinux.net :: moshe at runslinux dot net :: AIM: Jehsom
Sponsored Links






Free braindumps | Software forum | Database administration forum

Copyright 2003 - 2008 webservertalk.com