Adam Thornton wrote:
Hey, can we digress a little, and talk about Very Large Services,
Hardware, and Software Companies that *really* ought to know better,
who actually don't appear to know that the things after the http:
are forward, rather than back, slashes?
Yeah. Got one of those
On Sep 6, 2007, at 10:56 PM, John Summerfield wrote:
David Boyes wrote:
On 9/6/2007 4:31 PM, Edmund R. MacKenty wrote:
Note that I'm using $(...) instead of backticks. Backticks are
evil!
But I'm curious: why are backticks evil? (I didn't know about the
$(command) trick; I've been using
Subject
Re: I am
missing something basic with bash scripting.
Please respond to
Linux on 390 Port LINUX-390@VM.MARIST.EDU
On Sep 6, 2007, at 2:56 PM
On Thursday 06 September 2007 18:09, Stricklin, Raymond J wrote:
I would, however, use -e instead of -f, because the system
name is probably a directory, not a plain file.
indeed, then why not use -d ?
Because -e allows the script to neither know nor care what type of file is
there, just that
On Sep 6, 2007, at 11:29 PM, John Summerfield wrote:
Adam Thornton wrote:
Hey, can we digress a little, and talk about Very Large Services,
Hardware, and Software Companies that *really* ought to know better,
who actually don't appear to know that the things after the http:
are forward,
I wrote:
larry$ bash -c 'set -x; list=a|b|c; t=a; eval case $t in ( $list )
echo one;; b ) echo two;; esac'
Not sure if anyone's interested in this technique, but if you do try the
above, it won't work -- some email client/server and/or copy-and-paste
messed it up. It should be:
|bash -c
James Melin wrote:
I hadn't known about the $(...) function either until yesterday. So I've
learned MANY interesting tricks just by asking that simple question (many
thanks to everyone). I have hated the back-tik thing as well as it's really
inelegant however it was all I knew.
Add this one
John Summerfield wrote:
People here have been doing arithmetic using $(()) which is fine, but
only does integers. Sometimes one wants a decimal|floating point, so
this can often be used:
06:55 [EMAIL PROTECTED] ~]$ echo 'scale=4;(14595.470+200.00)/4331.00' | bc
3.4161
06:55 [EMAIL PROTECTED]
I am trying to get away from hard coded server names in a script using case for
valid name check
This works but is not good because as soon as you add a new server to the NFS
mountpoint list the script this is from has to be changed.
case $target_system in
abinodji | calhoun | itasca |
On Thu, Sep 6, 2007 at 4:53 PM, in message
[EMAIL PROTECTED],
James Melin [EMAIL PROTECTED] wrote:
-snip-
raw_list=`ls /clamscan/servers` #read list of mountpoints
-snip-
But even though the display of 'cooked_list' seems to be what I want it to
be, this never returns a match.
Anyone
Subject
Re: I am
missing something basic with bash scripting
.
-Original Message-
From: Linux on 390 Port [mailto:[EMAIL PROTECTED] Behalf Of
James Melin
Sent: Thursday, September 06, 2007 1:53 PM
To: LINUX-390@VM.MARIST.EDU
Subject: I am missing something basic with bash scripting.
I am trying to get away from hard coded server names in a script using
On Thursday 06 September 2007 16:53, James Melin wrote:
I am trying to get away from hard coded server names in a script using case
for valid name check
This works but is not good because as soon as you add a new server to the
NFS mountpoint list the script this is from has to be changed.
case
Subject
Re: I am
missing something basic with bash scripting.
Please respond to
Linux on 390 Port LINUX-390
Subject
Re: I am
missing something basic with bash scripting
On 9/6/2007 4:31 PM, Edmund R. MacKenty wrote:
Note that I'm using $(...) instead of backticks. Backticks are evil!
The InList() function is slick; I like it!
But I'm curious: why are backticks evil? (I didn't know about the
$(command) trick; I've been using backticks for a long time. I learn
parm_1=invalid
target_system=hadley
space=
delim= |
raw_list=$(/bin/ls /clamscan/servers)
cooked_list=$(echo $raw_list | sed -e s:$space:$delim:g)
echo Raw list = $raw_list echo cooked list = $cooked_list
case $target_system in
$cooked_list ) parm_1=valid ;;
esac
My $0.028 --
On Thu, Sep 6, 2007 at 5:10 PM, in message
[EMAIL PROTECTED],
James Melin [EMAIL PROTECTED] wrote:
I'll try that however my echo's are not revealing that to be the case.
Stay tuned.
If that doesn't help, then put a set -x right after the #!/bin/sh line, and
send the output, along with the
-
From: Linux on 390 Port [mailto:[EMAIL PROTECTED] On Behalf Of
James Melin
Sent: Thursday, September 06, 2007 5:10 PM
To: LINUX-390@VM.MARIST.EDU
Subject: Re: I am missing something basic with bash scripting.
I'll try that however my echo's are not revealing that to be the case.
Stay tuned
Because it is very hard to nest them.
-Original Message-
From: Linux on 390 Port [mailto:[EMAIL PROTECTED] Behalf Of
Eric Chevalier
Sent: Thursday, September 06, 2007 2:56 PM
To: LINUX-390@VM.MARIST.EDU
Subject: Re: I am missing something basic with bash scripting.
On 9/6/2007 4:31 PM
On Thursday 06 September 2007 17:56, Eric Chevalier wrote:
On 9/6/2007 4:31 PM, Edmund R. MacKenty wrote:
Note that I'm using $(...) instead of backticks. Backticks are evil!
The InList() function is slick; I like it!
But I'm curious: why are backticks evil? (I didn't know about the
$(command)
On 9/6/2007 5:04 PM, Fargusson.Alan wrote:
Because it is very hard to nest them.
Ah hah! I'd never thought about that.
Thanks!
Eric
--
For LINUX-390 subscribe / signoff / archive access instructions,
send email to [EMAIL
I would, however, use -e instead of -f, because the system
name is probably a directory, not a plain file.
indeed, then why not use -d ?
ok
r.
--
For LINUX-390 subscribe / signoff / archive access instructions,
send email
On Sep 6, 2007, at 2:56 PM, Eric Chevalier wrote:
On 9/6/2007 4:31 PM, Edmund R. MacKenty wrote:
Note that I'm using $(...) instead of backticks. Backticks are evil!
The InList() function is slick; I like it!
But I'm curious: why are backticks evil? (I didn't know about the
$(command)
Stricklin, Raymond J wrote:
I would, however, use -e instead of -f, because the system
name is probably a directory, not a plain file.
indeed, then why not use -d ?
ok
r.
Both good points -- use the operator best suited to the task. If you
want to make *sure* it's a file, use -f; if
-Original Message-
From: Linux on 390 Port [mailto:[EMAIL PROTECTED] On
Behalf Of James Melin
Sent: Thursday, September 06, 2007 3:53 PM
To: LINUX-390@VM.MARIST.EDU
Subject: I am missing something basic with bash scripting.
I am trying to get away from hard coded server names
Mark Post wrote:
If that doesn't help, then put a set -x right after the #!/bin/sh line, and
send the output, along with the command invocation.
or put -x on the shebang line:
#! /bin/sh -x
--
Carnegie Institution - At the Frontiers of Science
Larry Ploetz
Systems Administrator
On 9/6/2007 4:31 PM, Edmund R. MacKenty wrote:
Note that I'm using $(...) instead of backticks. Backticks are
evil!
But I'm curious: why are backticks evil? (I didn't know about the
$(command) trick; I've been using backticks for a long time. I learn
something new every day!)
Some uppity
Fargusson.Alan wrote:
The problem is that bash takes cooked_list as a single token in the case
statement. It matches the entire list of systems, and not each member of the
list. I don't know of any way around this. You will probably need to do
another for loop on raw_list and check for a
David Boyes wrote:
On 9/6/2007 4:31 PM, Edmund R. MacKenty wrote:
Note that I'm using $(...) instead of backticks. Backticks are
evil!
But I'm curious: why are backticks evil? (I didn't know about the
$(command) trick; I've been using backticks for a long time. I learn
something new every
You could do something else entirely, like:
larry$ a=a
larry$ echo $list
a|b|c
larry$ [[ $list =~ $a ]] echo hi || echo ho
hi
larry$ a=d
larry$ [[ $list =~ $a ]] echo hi || echo ho
ho
or
[[ $(ls /clamscan/servers) =~ $target_system ]] parm_1=valid
(assuming no system name is a subset of
31 matches
Mail list logo