| |
| |
| |
|
Page: 1 2 3 4 5 6 7 8
Comments:
<0> imadev:~$ <0> I don't see how you can get that error from sed unless one of the variables being expanded contains either a slash or a newline. <0> or possibly a trailing backslash <1> Just in case I ***igned LOCVAR like this <1> TMPVAR="`grep somealias /tmp/aliases`,$loginname" <0> so it contains multiple lines, separated by newlines. <0> that would do it. <1> greycat, Well... somealias is a huge alias... <0> also, WHY are you putting the output of grep into that variable? All you wanted to add was the ,$loginname part, right? <1> well.. Actually.. We have many aliases... say around 100 <1> diff department when a new user joins.. <1> We will update alias based on his dept <0> And somehow they ***igned *you* this job, despite your utter inability to manage simple unix commands...? <0> now, run this: echo "$LOCVAR" <1> so The idea was to search for somealias and append his email./loginname <0> And paste the result here.
<0> And then run this: echo "$TMPVAR" <0> And paste the result here. <0> Do NOT omit the quotation marks. <0> KEEP the quotation marks. <1> echo $LOCVAR <0> WRONG. <1> somealias <0> WRONG WRONG WRONG. <1> echo "$LOCVAR" <1> somealias <0> you are lying, aren't you? <2> i have two trees - /proj/prod and /proj/test. under each tree we have directories like "cgi" which we access using $CGI. is there some way to set BASE=/proj/prod and CGI=$BASE/cgi, such that when base gets changed so does CGI, or do you have to re-set all those relative paths? <0> just change both variables. <0> seriously. it's one extra line. <1> greycat, Well.. Lying in one thing.. somealias is a diff a legitimate email id <1> greycat, well.. Something interesting here... <0> if you set LOCVAR=somealias TMPVAR=,someloginname does it WORK THEN? <1> if I do echo "$TMPVAR" <0> ... you get multiple lines, right? <1> Yup <0> !pitfalls <3> http://wooledge.org/mywiki/BashPitfalls <0> #10. <0> !quotes <3> USE MORE QUOTES! http://www.grymoire.com/Unix/Quote.html <1> greycat, Now I got it working... But <1> Now I can see two somealias than one <0> Here we go again.... <1> one original and the otherone with the new entry appended to it <0> Because you have the wrong thing in your TMPVAR. <0> You have that godawful thing where you grepped a WHOLE LINE and then added stuff on to the end of it, instead of just having the part you want to add. <1> Now I modified it to TMPVAR="`grep ^localblrori /tmp/aliases`,$loginname" <0> TMPVAR should just contain ',foo' <1> and echo "$TMPVAR" shows one line <0> TMPVAR=",$loginname" <0> It should NOT have the whole line. <1> grepper, oops .. Got it <4> would like to read up on ${foo:0:8} where can i find docs on this? <1> one sec <5> is there a way to get echo to show my all the excape chars it's interping? something looks fishy about my output <0> !pe <3> Parameter Expansion. Expressions like ${foo%.mp3} and so on -- see man bash, and then search for Parameter Expansion. See also, http://wooledge.org/mywiki/BashFaq#faq74 and http://tiswww.tis.case.edu/~chet/bash/bashref.html#SEC30. <5> *escape <0> fedx_: remove the -e and it won't interpret anything. <4> parameter expansions. cool. did not know what it was called. thanks <5> it's doing this wierd thing where i tell it echo "$afile.txt" and it echos .txt<filename> <1> greycat, Man.. You are a genius <0> sounds like you have a literal carriage return inside afile <0> did you get it by grepping something from a file that's been edited by a Windows luser? <5> that's what i figured <1> greycat, It works like a dream <5> do it <5> ack.. no it's mysql output <0> echo "$afile" | cat -e <0> another handy one is od -t x1 <<< "$afile" but remember that this adds a newline just like echo. <0> and unlike echo, there's no -n to avoid that. <5> er no i don't want it to cat my file <0> *headdesk* <5> the mysql output is a list of files and i want to store <afilename>.txt in a var
<5> nevermind. <5> got ya <5> it's a ^M,.. which is that? <0> that's a carriage return. <6> greycat : whats the opposite of od? <7> thats dos nonsense <0> Staz: what are you trying to do? <6> Just curious how to reverse the 'od' process. <0> you don't, usually. <8> I need to concatenate parameters in a while until loop ... so ... how $mynewvar should be? mynewvar=$mynewvar + ${$counter} ? anyone can help with that ? <0> !faq concat <3> http://wooledge.org/mywiki/BashFaq#faq13 -- How can I concatenate two variables? <8> the problem its with $1 $2 variable <0> I see a lot of problems, and the first was the phrase "while until loop". <8> that index need to be another variable <0> !faq variable variable <3> http://wooledge.org/mywiki/BashFaq#faq44 -- How can I use ***ociative arrays or variable variables? <8> hehe, its the same problem with both cmds ... thats not the problem, its with $1 parameters <0> nwe: speak English, damn it. <8> well, ok, the problem its with parameter variable, not with flow control syntaxis <0> !faq variable variable <3> http://wooledge.org/mywiki/BashFaq#faq44 -- How can I use ***ociative arrays or variable variables? <0> That? <8> im checking thnx <8> STRING_OUT="$STRING_OUT + '$'$COUNTER"; <8> i need todo that in a loop <8> to store function parameters in STRING_OUT <0> PARAMETERS=(foo bar baz) <0> i=3 <0> while blah blah; do <0> PARAMETERS[i++]="$COUNTER blah blah blah" <0> done <0> mycommand "${PARAMETERS[@]}" <0> !faq dialog <3> http://wooledge.org/mywiki/BashFaq#faq40 -- How do I use dialog to get input from the user? <0> There's a really good example in there. <9> quick question how can I program in like a 'break' where the bash script will wait for the user to press enter to continue? <10> read <8> thanks grey there are lots of examples there i think i could use <11> hi <0> !faq pause <3> http://wooledge.org/mywiki/BashFaq#faq65 -- Is there a "PAUSE" command in bash like there is in MSDOS batch scripts? To prompt the user to press any key to continue? <0> !learn users http://wooledge.org/mywiki/BashFaq -- Why don't users ever read the FAQ themselves? Why do I always have to grep the whole file for their questions? Huh? Doesn't anyone ever think of the bot? <3> OK, greycat <12> http://www.pastebin.ca/345711 <12> what is wrong in that script ? <13> you're the one who has run it - how does its behaviour differ from what you want? <14> Asche: nothing <12> but when i run it <12> void:/# ./prueba <12> ./prueba: line 12: syntax error: unexpected end of file <12> void:/# <15> there is a ';' missing before the '}' on line 5 <15> additionally the script cannot handle file names with whitespace, and is badly formatted <6> pastebin still hasn't loaded for me :P <13> Staz: no huge loss <12> it stills <12> ./prueba: line 12: syntax error: unexpected end of file <15> Asche: could you post your corrected version? <6> to rafb this time :P <12> yes <0> !pastebins <3> http://pastebin.ca - http://pastebin.com - http://rafb.net/paste <0> !forget pastebins <3> OK, greycat <0> !learn pastebins http://rafb.net/paste - http://pastebin.ca <3> OK, greycat <7> rafb is good <12> today i started with bash <12> hehe <12> heres is the corrected version <12> http://www.pastebin.ca/345716
Return to
#bash or Go to some related
logs:
win32 codec* suse rpm installing apache2.2 ubuntu clearsign failed: secret key not availab kimagedest undefined #linux obexftp finnish #debian #postfix opposite of htmlspecialchars #physics
|
|