#bash
27 December 2007
Total 14 pages. You are browsing page 1/14.
First :: Prev :: [1] [2] [3] [4] [5] [...] :: Next :: Last
--- Log opened Thu Dec 27 00:00:51 2007
00:08 <****> I need to do something like this but it fails because the folder may not exist
00:08 <****> find proguard/ -name "*.properties" -exec cp -vf {} ../classes/{} \;
00:09 <****> how does it fail?
00:10 <****> can not create regular file no such file or dir
00:11 <****> it won't run the command if it can't find files
00:23 <****> KWhat4: then you should create the "folder" (hahahahahaha) too.
01:47 <****> http://www.cybertown.com/cgi-bin/jail/place?plc=jail&ac=place&ID=0000000000000033&force=s
02:30 <****> what variable gives me the function name, inside the function?
02:39 <****> duli: $FUNCNAME (which is actually the zeroth element of an array)
02:40 <****> \amethyst: ok, tks!
03:34 <****> How do I keep command substitution from deleting newlines?
03:34 <****> rtc: you mean newlines at the end, or newlines in the middle?
03:35 <****> amethyst: both
03:35 <****> amethyst: although at the end is not so important
03:35 <****> rtc: you can't keep it from deleting trailing newlines
03:35 <****> rtc: it doesn't delete newlines in the middle--word splitting does
03:35 <****> !umq
03:35 <****> Use more quotes!
03:35 <****> amethyst: I tried
03:36 <****> rtc: storing it in a variable?
03:36 <****> amethyst: well, I did x="`cmd`"
03:36 <****> rtc: you have to quote "$x" too
03:37 <****> rtc: also, x="$(cmd)" is more readable, and nests much more easily than ``
03:37 <****> ah, that works. thanks... sorry, I'm used to zsh, where I don't have to add quotes when evaluating the variable.
03:38 <****> zsh is unlike all other shells, in that way and others.
03:38 <****> yes, I know.
03:38 <****> all other shells do word splitting after parameter expansion.
03:39 <****> I tend to like the zsh behavior better
04:44 <****> Good evening
04:44 <****> I'm having an issue writing a variable name to a file.
04:44 <****> if I echo the statement locally from a CLI, it works fine.
04:44 <****> but when i put the EXACT SAME STATEMENY
04:44 <****> into a script, it wont work correctly
04:45 <****> Coder365_: what is the statement?
04:45 <****> hold on
04:45 <****> $phpfile
04:46 <****> changing the $phpfile variable to a static file does no good
04:47 <****> In my troubleshooting, I have concluded that when I add the = to the satement, it starts to mess up
04:47 <****> like the =\"up\";" overwrites the output of \$$pdns
04:47 <****> Coder365_: when you say putting this into a script doesn't work
04:47 <****> so I end up with something akin to this fin the file
04:47 <****> you mean a shell script or a PHP script?
04:48 <****> shell
04:48 <****> sorry
04:48 <****> = "up";rage
04:48 <****> when that is really supposed to be $netstorage = "up";
04:48 <****> and it's exactly the same, whitespace, quotes, and all, in the shell script ?
04:48 <****> Yep
04:48 <****> oh, wait
04:49 <****> it looks like you have a stray carriage return
04:49 <****> where?
04:49 <****> it's printing $netstorage\r = "up";
04:49 <****> so the space through semicolon overwrite the beginning of $netstorage
04:49 <****> how do i fix that?
04:50 <****> where did pdns come from?
04:50 <****> a file
04:50 <****> I did a "... read variable1 pdns
04:50 <****> using $( ) or what?
04:50 <****> cat file | while read var1 pdns do....
04:50 <****> Coder365_: ah, redirected from the file?
04:51 <****> Yes
04:52 <****> Coder365_: use tr -d '\r' or something like that
04:52 <****> Coder365_: tr -d '\r' file | while read blah blah; do; done
04:52 <****> so replace cat with tr-d"\r'
04:52 <****> er ... -d "\r'
04:53 <****> use spaces, and use the same quotes, but yes
04:54 <****> that deletes the carriage return character
04:56 <****> \amethyst: did you intend for that to be tr -d "\r" file....
04:56 <****> instead of tr -d "\r" file....
04:56 <****> er
04:56 <****> "\r'
05:00 <****> I wrote '\r'
05:00 <****> either "\r" or '\r' works
05:00 <****> okay
05:03 <****> omg
05:03 <****> THANK YOU
05:04 <****> file1
05:04 <****> mv file1 file
05:04 <****> you don't need the cat there, but that works :)
05:04 <****> thanks!
05:05 <****> well that way I can run the script as I had it
05:05 <****> but anyway man, thanks a lot!!
05:36 <****> uniq has an option, -f=N, that allows you to 'avoid comparing the first N fields'. what if I only want it to compare the first field?
05:39 <****> there is another option, -w=N, that allows you to compare only the first N characters, but the length of the value in each column varies, there is no coressponding "compare only the first N fields" that i can figure out...(sort has such an option)
05:42 <****> aib: you want it to only compare the first field, and not the rest of the line?
05:42 <****> yep
05:42 <****> uniq's option seems strangely backwards to me...
05:43 <****> not to me ... most of the time, I would want to compare the first field (and anything following) but there may be a rare situation where I want to skip the first field and start comparing at the second.
05:43 <****> why don't you pipe it through sed or awk or something? do you need to see the data that would be stripped?
05:44 <****> use sort -u instead
05:45 <****> sort lets you specify the field
05:45 <****> i had forgotten sort will emulate uniq..thanks
05:46 <****> probably because of problems like this :)
05:49 <****> I guess sort -mu would be faster if you know it's sorted by that key already
05:51 <****> i'm trying to merge two different files that share an id column (the key). e.g., doc1='id b c';doc2='id d e f g h', but the second file has ids that aren't in the first file, and i only want the ids that are in both
05:51 <****> eventually i'm going to `paste' them together
05:52 <****> so for i've not seen a way to do this
05:54 <****> Perhaps you should look outside of bash.
05:54 <****> why..? tools like cut, paste, sort and uniq were made for tasks like this.
Total 14 pages. You are browsing page 1/14.
First :: Prev :: [1] [2] [3] [4] [5] [...] :: Next :: Last
