Search Results

Search: Posts Made By: Phil3759
6,800
Posted By Corona688
Single-quoting a > will not let the shell parse...
Single-quoting a > will not let the shell parse it later. The quotes cease to exist when the string is stored, they only tell the shell what to do with a string right then, they don't change the...
6,800
Posted By Corona688
The shell does these and only these things to an...
The shell does these and only these things to an unquoted $VARIABLE:

Splits into arguments on whitespace. (Technically, it splits on any character in the IFS variable, which you can alter at...
6,800
Posted By hanson44
I would also like to know. My best guess is that...
I would also like to know. My best guess is that shell quotes the redirection in this context because the redirection symbol can also be used as a literal character, and it was decided the literal...
6,800
Posted By hanson44
So, it seems the > was quoted into ' ' by the...
So, it seems the > was quoted into ' ' by the shell
I tried to escape the > using \> in my $CMD_LINE1, but it did not fix it

Just want to understand things. Is there any way to escape
the > and...
6,800
Posted By Corona688
Shell scripting does not work this way. Once a...
Shell scripting does not work this way. Once a string is inside a variable, it doesn't get reparsed for quotes, escapes, or substitutions anymore.

You'd have to use eval, which is a very bad idea...
6,800
Posted By hanson44
Yes, "set -x" can be pretty useful. It can create...
Yes, "set -x" can be pretty useful. It can create a lot of output, which can be difficult to wade through. But for the most part "set -x" shows what is going on, what the shell "sees".
6,800
Posted By hanson44
You can see what is happening, why it does not...
You can see what is happening, why it does not work, if you use "set -x" at the top of the shell script.

Unless there is some good reason (can't think of any), do not try putting an entire command...
6,800
Posted By Corona688
It is a mystery. It really shouldn't do that. ...
It is a mystery. It really shouldn't do that.

Show me the exact line that didn't work please -- unabridged, no substitutions, exactly as you had it. The entire script, even. There may be...
6,800
Posted By Corona688
That is very odd. If that really is the code,...
That is very odd. If that really is the code, there's no reason at all for it to do that... I suspect your version ended up a little different somehow, but would need to use strace or something to...
6,800
Posted By Corona688
Well, stdout is the file, by definition, so it...
Well, stdout is the file, by definition, so it can't be writing to stdout... Try running nohup mkbootfs ... and seeing if the output ends up in nohup.out.

Without knowing the code of mkbootfs...
6,800
Posted By Corona688
Well, you weren't doing the same thing in...
Well, you weren't doing the same thing in terminal, you were doing command > file

In the script, you change it to command | cpio > file

Is cpio really needed here when it wasn't needed in the...
6,800
Posted By jim mcnamara
cpio -O outputfilename writes cpio output to...
cpio -O outputfilename

writes cpio output to a file, is that what you want? Seems like it.
8,802
Posted By elixir_sinari
Change $0=$0 RS repl to $0=repl RS $0.
Change
$0=$0 RS repl
to
$0=repl RS $0.
8,802
Posted By elixir_sinari
$0 --> current input...
$0 --> current input record/line (awk reads one record/line at a time).
~ --> match operator.
"^[ \t]*"patt"[ \t]*$" --> this becomes ^[ \t]*chmod 0771...
8,802
Posted By elixir_sinari
That would need a very small change: awk...
That would need a very small change:
awk '$0~"^[ \t]*"patt"[ \t]*$"{which++;if(which==n)$0=$0 RS repl}1' patt="$pattern" repl="$new_pattern" n=$n data.db
to
awk '$0~"^[ \t]*"patt"[...
8,802
Posted By elixir_sinari
In that case, try: awk '$0~"^[ \t]*"patt"[...
In that case, try:
awk '$0~"^[ \t]*"patt"[ \t]*$"{which++;if(which==n)$0=$0 RS repl}1' patt="$pattern" repl="$new_pattern" n=$n data.db
No need to provide for spaces/tabs before/after the pattern.
8,802
Posted By elixir_sinari
For your info: $ cat data.db HHOOIOIOI ...
For your info:
$ cat data.db
HHOOIOIOI
system /path1/file1 file1
system /path1/file1 file1
/system/path
system /path1/file1 file1
dfdfdf
dfdffffffffffff
dfdf
system /path1/file1...
8,802
Posted By elixir_sinari
data.db will not be edited by that command (as...
data.db will not be edited by that command (as opposed to that done by the -i switch of sed). You'll need to redirect the output of that command in a temporary file and then, rename that temporary...
8,802
Posted By elixir_sinari
pattern="system /path1/file1 file1" ...
pattern="system /path1/file1 file1"
new_pattern=" data /path2/file2 file2"
n=3
awk '$0==patt{which++;if(which==n)$0=$0 RS repl}1' patt="$pattern" repl="$new_pattern" n=$n data.db
Replace value of...
Showing results 1 to 19 of 19

 
All times are GMT -4. The time now is 01:30 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy