>> >From a script: main.sh, I need to:
>> 1. Copy file ./x to /tmp/x
>> 2. Read a variable from stdin, for example: read VALUE
>> 3. Search through file /tmp/x for the keyword REPLACE, and replace it
with ${VALUE}
>>
>> I can't seem to figure out what combination of sed, perl, whatever I can
use.
Just replace the single quotes with double quotes. Single quotes are
keeping the $vars from being evaluated.
sed "s/REPLACE/${VALUE}/g" /tmp/x > /tmp/x.new
Klif
--
redhat-list mailing list
unsubscribe mailto:[EMAIL PROTECTED]?subject=unsubscribe
https://listman.redhat.com/mailman/listinf
On Tue, 2002-12-03 at 15:54, Shaw, Marco wrote:
> >From a script: main.sh, I need to:
> 1. Copy file ./x to /tmp/x
> 2. Read a variable from stdin, for example: read VALUE
> 3. Search through file /tmp/x for the keyword REPLACE, and replace it with ${VALUE}
>
> I can't seem to figure out what comb
On Tue, 2002-12-03 at 14:54, Shaw, Marco wrote:
> >From a script: main.sh, I need to:
> 1. Copy file ./x to /tmp/x
> 2. Read a variable from stdin, for example: read VALUE
> 3. Search through file /tmp/x for the keyword REPLACE, and replace it with ${VALUE}
>
> I can't seem to figure out what comb
Thanks to both of you for responding. The empty quotes works best for
what I wanted to do (which I should have been clearer on in the first
place). I wanted to make the first choice in a menu the "default", ie,
just hit , and the empty quotes allow me to do that:
echo -e " Your selection, pl
On 14:05 18 Jul 2002, Joe Nestlerode <[EMAIL PROTECTED]> wrote:
| Can you put a carriage return (enter) as one of the choices in a 'case'
| construct? *) will catch it, but I need that for the "Invalid Choice"
| catch-all at the end. I couldn't find it in the documentation; is this
| possible
Now that I think about it, you asked for how to check
for a response of just cr-lf. Here's what I should
have sent you:
#!/bin/bash
echo "Please answer yes or no: "
read answer
if [ x"$answer" = x"" ];
then
echo
echo "*** Invalid Response! ***"
echo
exit -1
fi
I think what I would do is put a check in for an empty
response before the case statement is ever reached.
Here's an example of what I mean:
#!/bin/bash
echo "Please answer yes or no: "
read answer
if [[ x"$answer" != x"yes" && x"$answer" != x"no" ]];
then
echo
echo "*** Invalid
On Fri, 2002-07-12 at 15:56, Joe Nestlerode wrote:
> Thank you, that works beautifully. I modified it slightly to allow a
> user to enter a search pattern on the command line, to wit:
>
> #!/bin/sh
>
> echo -e "Enter a file or pattern to search for...\n"
> read file
>
> for i in `find . -name
Saul,
Thank you, that works beautifully. I modified it slightly to allow a
user to enter a search pattern on the command line, to wit:
#!/bin/sh
echo -e "Enter a file or pattern to search for...\n"
read file
for i in `find . -name "$file"`
do rm -i $i
done
exit 0
Thanks again!
Joe
[EMA
On Fri, 2002-07-12 at 13:13, Joe Nestlerode wrote:
> I'm trying to write a simple script to search a directory tree for a
> file pattern (specified as an argument with a wildcard, ie, testfile* or
> *.jpg), and then delete matching files after first prompting the user
> for a y/n. (yes=delete,
11 matches
Mail list logo