#bash
30 December 2007
Total 14 pages. You are browsing page 1/14.
First :: Prev :: [1] [2] [3] [4] [5] [...] :: Next :: Last
--- Log opened Sun Dec 30 00:00:58 2007
00:01 <****> if [[ loading == *${mount}* ]]
00:01 <****> If ${mount} is "test-loading.test"
00:01 <****> shouldn't that be true?
00:01 <****> Would anyone know how to get 'wget' to save a d/l-ed file to a specific name?
00:02 <****> RadSurfer: -O
00:02 <****> Capitol O
00:02 <****> if [[ $mount = *loading* ]] foo
00:02 <****> man that nick is a /bad/ idea
00:03 <****> igli: doh, thanks.
00:04 <****> heh
00:04 <****> igli: Are you saying I have a bad nick? How dare you
00:04 <****> bad choice, and you should know it ;)
00:04 <****> igli: You're jealous, face it.
00:04 <****> :)
00:04 <****> foo=(alpha beta gamma)
00:04 <****> heh
00:05 <****> yeah right, that's it :roll: ;p
00:05 <****> file # not my fault it highlights you ;p
00:05 <****> mv igli /dev/null;
00:06 <****> unlink foo # ;p
00:06 * foo screams and runs at igli with wild fruit juice
00:07 * igli sips the juice: thanks :)
00:07 <****> haha
00:12 <****> /dev/null' instead. Is there a prettier (and faster) way to do this?
00:13 <****> !nullglob
00:13 <****> nullglob: a shell option (shopt) which causes unmatched globs to expand to nothing, rather than themselves. Example: shopt -s nullglob; files=(*); echo "There are ${#files[*]} files."
00:13 <****> igli: I know nullglob. So how do you suggest I test whether any *.txt exist?
00:14 <****> igli: Oh. Using files=(*) and testing for the length of files?
00:14 <****> yes :)
00:14 <****> igli: Okay, thanks :)
00:15 <****> if ((${#files[*]})); then .. ; else echo 'ohNoes!'; fi
00:17 <****> igli: OTOH, this reads pretty... perlish. I think I *might* just go back to ls (even though it's slow and not quite reliable). :-) Thanks for enlightening me though!
00:17 <****> !ls
00:17 <****> Please NEVER parse, pipe, grep, capture, read, or loop over the output of 'ls'. Unlike popular belief, 'ls' is NOT designed to enumerate files or parse their statistics. Using 'ls' for this is dangerous (word splitting) and there's always a better way (eg. globs).
00:18 <****> get your head round arrays: they're very useful
00:18 <****> !array
00:18 <****> Arrays RULE! See http://wooledge.org/mywiki/BashFAQ#faq5 -- Remember !$@ applies to normal arrays as well as argv.
00:20 <****> /dev/null' be bad? Except that it might fail if there's some read error or so?
00:21 <****> bad habit, and you're only doing it to avoid learning ;)
00:31 <****> i have 70 numbered files, file1.mp3,file2.mp3... file70.mp3 ; the correct filesnames are in a names.txt file .. each name in the file is also numbered and seperated by newline 1) correct name ; 2) foobar 70) .. how i can use the names.txt to rename all the file*.mp3
00:35 <****> anyone know of a magical bash to posix script converter?
00:36 <****> didn't think so :P
00:36 <****> inv_arp[work]: I'm not sure how your names.txt looks like. This script renames according to the names on stdin, extension is optional. http://pastebin.ca/837865
00:36 <****> just use read
00:36 <****> lea_w: Note: Might contain errors or bugs.
00:36 <****> (if that doesn't work)
00:38 <****> files=(*.mp3); while read -r num name; do num=${num%)}; mv "${files[num-1]}" "$name"; done # perhaps
00:38 <****> done < file
00:38 <****> (i'd stick echo in front of mv, usual disclaimers)
00:39 <****> ahh ok
00:50 <****> authorized_keys ... ssh public keys login is available in sshdconfig ..... i've also run ssh -v and seen that its TRYING to send ssh keys... but failing i guess .. i'm at my wits end .... ideas?
00:54 <****> #openssh
00:59 <****> .ssh/authorized_keys ?
01:00 <****> arooni-mobile: are the permissions on .ssh/authorized_keys and .ssh correct?
01:01 <****> arooni-mobile: perms should be recursively 700 ~/.ssh
01:01 <****> let me check
01:02 <****> also ~
01:02 <****> shouldn't be group- or other- writable
01:02 <****> ok well i did: chmod 700 -R .ssh (on both laptop and PC)
01:03 <****> also chmod go-w ~
01:04 <****> heres the error messsages: http://pastie.caboo.se/133103
01:04 <****> arooni-mobile: what about the server-side logs
01:04 <****> ?
01:05 <****> \amethyst, http://pastie.caboo.se/133104
01:06 <****> arooni-mobile: and you've double-checked and verified that the ~/.ssh/authorized_keys file on the server contains the correct key, that corresponds to your ~/.ssh/id_dsa.pub on the client?
01:08 <****> hello! what was the name of that command... to get consecutive numbers? (kinda like range() in python)
01:09 <****> arooni-mobile: can you turn up LogLevel in sshd?
01:09 <****> !seq
01:09 <****> seq(1) is a highly nonstandard external command used to count to 10 in silly Linux howtos. Use one of these instead: for x in {1..10} (bash3.x) or for ((x=1; x<=10; x++)) (bash 2.04+) or i=1; while [ $i -le 10 ]; do ...; let i++; done
01:09 <****> I'll go with {1..10} :)
01:10 <****> note that it only works with constants
01:10 <****> oh...
01:10 <****> not good :)
01:11 <****> andresj
01:11 <****> andresj: C-like for-loops: http://bash-hackers.org/wiki/doku.php?id=syntax:ccmd:c_for
01:11 <****> no python-like loops? :)
01:11 <****> python is too slow to loop.
01:11 <****> ?
01:12 <****> for x in range(1, 10): ...
01:12 <****> yes, here's the missing smiley: ;-)
01:12 <****> ha ha :)
01:12 <****> seq () { for (( i=$1; i<=$2; i++)); do echo $i; done; }
01:12 <****> \amethyst, hmmm yes the keys match up... not sure how to turn up log levels
01:13 <****> for x in $(seq 1 100); do ...; done
01:13 <****> does that local i?
01:13 <****> oh, good point, add local i at the beginning
01:14 <****> \amethyst thanks! :) although I'm pretty sure the two machines I will use the script on will have seq already...
01:14 <****> add local i where?
01:14 <****> local and spaces, the things i waste time on with bash
01:14 <****> andresj: inside the seq function I wrote above
01:14 <****> "seq () { local i; for (( i=$1; i<=$2; i++)); do echo $i; done; }"?
01:14 <****> indeed
01:14 <****> why are you even writing that function
01:15 <****> bruenig: in case it's not a GNU machine
01:15 <****> no but why don't you just use the type of for loop you are writing in the function
01:15 <****> less forking is always good
01:15 <****> bruenig: readability
01:16 <****> I second that
01:16 <****> perhaps, readability is subjective so you can't argue that
Total 14 pages. You are browsing page 1/14.
First :: Prev :: [1] [2] [3] [4] [5] [...] :: Next :: Last
