I can't understand why inserting 4 backslashes instead of 2 or 3 worked
because one backslah is not important in csh
needed X2
both of '\' and 'n' escape its special means
then
\\ --> \
\\ --> n
5 backslah also same state ( last of \ like newline char in shells and doesnt anything in command in below)
actually
is special character it has a mean
eval(actually csh) trying process but \A has no special mean on csh
it will be process only echo and one of backslahs isnt here
And '\' and 'n' is a char in csh
Regards
ygemici
I'm very sorry, I didn't mention the fact that I was using bash. So, the examples u gave don't give me the results that u mention. My question is :
both give output as h, but
gives output as \h
Does eval here just remove backslashes (I know the use of eval in the case where substitutions occur)
I'm very sorry, I didn't mention the fact that I was using bash. So, the examples u gave don't give me the results that u mention. My question is :
both give output as h, but
gives output as \h
Does eval here just remove backslashes (I know the use of eval in the case where substitutions occur)
* First of all let look the below
\ --> does no effect to echo
* Anyway
first \ char is meaningless in here and echo after \ chars so \++
so echo already write on the newline
but the trick for use ""
use this to remove its special meanings
Anymore \ is calculating with "" too
\ and \\\\++
so echo \\\\++ --> is to be \\++
\\ \\ --> two backslah is mean (one backslah) + two backslah is mean (one backslah) --> one + one = two backslah ( \\ )
"\" and \\\\++
so echo \\\\++ --> is to be \\\++
\\ \\ --> two backslah is mean (one backslah) + two backslah is mean (one backslah) --> one + one = two backslah ( \\ )
\\ plus "\" --> \\\ three backslah and ++ ---> \\\++
Now in examples
1-)
\ and \++
first \ char doesnt change in the output
so echo \++
2 -)
\ and \\++
first \char .....
so echo \\++ --> is to be \++ because two \\ originally is one \
\\ --> \
3-)
\ and \\\++
first \char .....
so echo \\\++ --> is to be \\++
\\ \ --> two backslah is mean (one backslah)+ one backslah --> one + one = two backslah ( \\ )
4-)
\ and \\\\++
so echo \\\\++ --> is to be \\++
\\ \\ --> two backslah is mean (one backslah) + two backslah is mean (one backslah) --> one + one = two backslah ( \\ )
* Eval ; so eval removes the first backslash..
---> eval removes the backslash and echo processing..
---> eval removes the backslash and echo processing..
---> eval removes the backslash and echo processing..
Thanks a gigaton ! It really was of great help. I will just mention what I have understood.
A backslash removes any special meaning of the symbol succeeding it. If there is no special symbol (like $,\,`,etc.) succeeding it, the backslash is removed.
In the following, the special meaning of the succeeding character is removed.
Similarly, in
the first \ tells that the next slash is to be taken literally (and is itself not printed), so one slash (the second one) is printed. The third slash has no special character after it, so its not printed. The output is :
Similarly
. The first and 3rd \ tell that the next \ has to be taken literally, and hence the 2nd and 4th are printed.
As for a backslash within quotes, it has special meaning only when followed by \,$,',",newline. Otherwise, its a simple character.
Here, since \ is not followed by the above mentioned characters, it is treated as a simple character.
Here, \ is followed by \ (a character in the above list) and so is treated specially (i.e. it makes the following character an ordinary one and is itself removed)
Now, for eval. Eval parses the argument once without executing the command, and then again, this time executing it too.
On the first parse, the first backslash makes the second \ be treated as an ordinary character, and is itself removed. So, after the first parse, the argument is \g. A similar thing happens in the second parse, and the output is therefore, g.
Now, in the first parse, what happens is similar to the example I gave a few lines above (the same thing as u type it without eval), and so after the first parse u have : \\g as the argument. Now, in the second pass, the first / makes the next slash appear as an ordinary character, and is itself rmeoved, so we have a single slash followed by g as the answer.
datafile:
blah,blah,blah,blah,blah,blah,blah,blah,blah=0_nblah=0-- ,blah,blah,blah
im using the following command to turn the "_n" and "-- " to just a space " " only in the $9th field. meaning, it has to make the changes only in the 9th column/field of the datafile.
awk -F, '{... (1 Reply)
Hi all,
Hoping someone hoping someone might be able to help. i've got the following sed command which i'm using in a bash script that i'm trying to use to insert a new line into an already existing file so i don't have to manually enter it when setting stuff up. the existing script test2/3 are... (3 Replies)
hello,
is it a behavior of or
that "-i" removes unix link .
example :
i create a file "src_file" and link it to "link_file" and then i start "perl -i"
the link is removed. does another option exists to change content of a file without temporary files ?
UNIX-Version: HP-UX and... (2 Replies)
Hi Team,
Please find below error. I got this after i done something in aptitude. Actually i was trying to update all packages, but unfortunately I removed all packages.
Now my server is down. When i boot it gives me me errors of missing .so files.
Is there any way to repair my server... (2 Replies)
Hi all,
some small script with eval turned me to crazy.
my OS is linux
Linux s10-1310 2.6.16.53-0.8.PTF.434477.3.TDC.0-smp #1 SMP Fri Aug 31 06:07:27 PDT 2007 x86_64 x86_64 x86_64 GNU/Linux
below script works well
#!/bin/bash
eval ssh remotehost date
eval ssh remotehost ls
below... (1 Reply)
I have the simple gawk script below. When the script runs in the output of all the ITM lines the FS is replaced with a space, the Non ITM lines retain the | field separator.
The ITM lines have many fields and I can't insert "|" between each field because some of the fields are blank.
Is... (1 Reply)
I have a script that reads from a file and deletes all files in tha path specified in the file.The problem,however, is the script also deletes itself from the home directory where I run it :-(
#!/bin/ksh
while read DAYS PURGE_PATH
do
cd $PURGE_PATH
find . \( -type d ! -name . -prune \)... (5 Replies)