#bash
15 November 2007
Total 4 pages. You are browsing page 1/4.
First :: Prev :: [1] [2] [3] [4] [5] [...] :: Next :: Last
--- Log opened Thu Nov 15 00:00:34 2007
00:04 <****> hm, how can i output the last named parameter? is that possible?
00:05 <****> i mean something like ${$#} but only done right :)
00:05 <****> i know there is a way to refer to a variable by its name, but i forgot how
00:28 <****> 0 && $1 = "-g" ]] && { echo y; } || echo n)
00:28 <****> 0 && $1 = "-g" ]] && { shift; echo y; } || echo n)
00:29 <****> after that line $1 is still "-g"
00:29 <****> what is wrong?
00:32 <****> litb: help test
00:32 <****> STRING2
00:32 <****> True if STRING1 sorts after STRING2 lexicographically.
00:32 <****> 0 ))
00:32 <****> which is the same as (( $# ))
00:32 <****> thanks i will change it
00:33 <****> so just do something like (( $# )) && [[ $1 = -g ]] && USE_GUI=1 || USE_GUI=0
00:33 <****> i already smelled that problem, but i use only 2 arguments at max anyway, so i ignored it
00:33 <****> oh, that is a nice way of doing it
00:34 <****> i want to shift the arguments if USE_GUI is 1
00:34 <****> later you can do an if (( USE_GUI )); then ..; else ..; fi
00:34 <****> since i don't want to care about that -g anymore after it
00:34 <****> anyway is that good or bad to shift then?
00:34 <****> (( $# )) && [[ $1 = -g ]] && { shift; USE_GUI=1; } || USE_GUI=0
00:34 <****> no problem.
00:34 <****> ok, thanks
00:34 <****> i suspect $(....) runs in its own shell?
00:34 <****> yes.
00:35 <****> strange, i tested it on the commandline: echo $(shift) , and it affected $1
00:36 <****> it's a subshell; not quite entirely a new process.
00:36 <****> side-affects may pop up appearantly.
00:36 <****> ah
00:37 <****> hmm, but in my script, $1 didn't change after that
00:37 <****> lhunath@avaria ~ $ set -- 1 2 3
00:37 <****> lhunath@avaria ~ $ echo "$@"; ( shift; echo "$@"; ); echo "$@"
00:37 <****> 1 2 3
00:37 <****> 2 3
00:37 <****> 1 2 3
00:37 <****> doesn't look like shift has shifted the positional parameters in the parent shell.
00:39 <****> one other question
00:40 <****> is that && ... || ... instead if if / else / fi considered dirty ?
00:40 <****> barely.
00:40 <****> it's just dangerous sometimes.
00:40 <****> litb
00:40 <****> litb: http://wooledge.org/mywiki/BashGuide
00:40 <****> read the conditinal operators chapter
00:40 <****> it covers the dangers a little.
00:42 <****> hmm, this is again strange: { echo j; shift; } || echo y outputs both j and y , but (($#)) && [[ $1 = "-g" ]] && { USE_GUI=y; shift; } || USE_GUI=n works as expected
00:42 <****> maybe i should really read a bit more in its manpage
00:43 <****> ah, nvm
00:48 <****> Anyone recommend a binary or bash script for generalized & automated FTP sessions with error checking?
00:54 <****> hobbzilla: can you use curl or wget?
00:57 <****> does curl or wget allow me to make FTP connections?
00:57 <****> It appears curl does..
00:58 <****> (and yes I can use either).
01:00 <****> hm, sorry for my many questions o.O
01:02 <****> savetheWorld: curl looks like download only?
01:03 <****> hobbzilla: I was actually just asking if you could use curl:http instead of ftp because it seems simpler/easier to me to script a curl action. If all you have is ftp access then the answer would be no, which is fine.
01:05 <****> savetheWorld: well it looks like curl can be used for upload & download and connections via FTP. However it certainly isn't as intuitive as "ftp" itself.
01:25 * unwiredbrain says hi to everyone
01:25 <****> nobody here?
01:26 <****> find -name '/home/horselogy/worker/Erotic_Games_RP/x-bj_queens/Files/tmp/*.jar' -exec cp {} $HOME \; but it is not workinG? what can i do
01:28 <****> um
01:28 <****> put the path after find, and then -name '*.jar'
01:29 <****> How can I md5 a string -- a string, **not** a file, like php?
01:29 <****> pipes?
01:29 <****> echo "a string" | md5sum
01:30 <****> md5sum <(echo "a string")
01:30 <****> md5sum <<<$(echo "a string")
01:31 <****> and so forth
01:32 <****> OK. Great. Thanks.
01:32 <****> Now: why the string generated is different from the php's md5 one?
01:33 <****> or simply md5sum <<<"a string"
01:34 <****> echo seems superfluous
01:35 <****> $ echo "test" | md5sum returns d8e8fca2dc0f896fd7cb4cb0031ba249
01:35 <****> so does md5sum <<<"test"
01:36 <****> returns 098f6bcd4621d373cade4e832627b4f6
01:36 <****> where's the issue!?
01:36 <****> :-s
01:37 <****> maybe because md5sum implicitly reads a '\0' at the end of the string?
01:37 <****> tested. nope.
01:37 <****> echo -n test | md5sum
01:38 <****> Hell, yeah!
01:38 <****> That's the point...
01:38 <****> :|
01:39 <****> damn echo... :)
01:39 <****> :)
01:39 <****> thansk guys
01:39 <****> thanks*
01:46 <****> is there anything wrong at that line :
01:46 <****> mkdir '/home/horselogy/worker/Erotic_Games_RP/x-bj_queens/tmp/' & cd /home/horselogy/worker/Erotic_Games_RP/x-bj_queens/Files/ & find -name '*.ja*' -exec cp {} "/home/horselogy/worker/Erotic_Games_RP/x-bj_queens/tmp/" \;
01:47 <****> I think you want &&
01:47 <****> creating a tmp directory than searching for jad and jar files in Files directory than copies findings to tmp ? is it ok?
01:48 <****> and i think you want "*.ja*"
01:48 <****> "*.ja?" would be better i think
01:49 <****> slack ok i am tring
01:50 <****> what kind of sick project are you working on
01:50 <****> trying*
01:54 <****> for a mobile phone
01:55 <****> game seller
01:55 <****> hmm, i was just putting together Erotic, Horseology, bg, queen
01:56 <****> s/bg/bj/
Total 4 pages. You are browsing page 1/4.
First :: Prev :: [1] [2] [3] [4] [5] [...] :: Next :: Last
