| |
| |
| |
|
Page: 1 2 3 4 5 6 7 8 9 10 11
Comments:
<0> ev: why? <1> for my script.. I need to retrieve the current volume of one stereo channel so I can set the alternate one <0> ev: why do you rely on amixer's output? <2> twkm, how would you do it ? <1> twkm: because I'd rather have a bash script than code something in C to link directly into alsalib <0> i wouldn't care. let the use adjust it using whatever tool they prefer. scripts/programs that **** with my settings get deleted. <0> err, let the user ... <2> twkm, he is the user. <1> ...yep :p <1> sed -e 's/.*\[//' <<< "[40%] [20%] [-30.00" <--- ahh, I see. this is what was confusing me. I thought sed would stop at the first matched [ <1> but I see it will proceed through it till it finds the last matching [ instead, to bound the expression <0> .* is greedy. <1> gotcha <1> thanks :) <3> morning <2> {xmb}, guten morgen
<3> hello too <4> clear <5> G'day yall <5> TheBonsai, redduck666, Remember I was working on that script to monitor pings off my router yesterday? <5> Found the answer today, `ping -f`, works a charm, prints a period . for ping sent, a backspace for ping received, so you see dots when it fails, nothing when it works <5> No scripting required... :) <6> -bash: symbol lookup error: -bash: undefined symbol: rl_variable_value <6> any idea why does it's happening <0> you don't have the readline library installed. <0> or you do but it cannot be found at link time. <6> twkm: is it for me <0> you for yes is. <6> ok thanks twkm <6> twkm: readline-5.1-22 is there <0> bash can't find it. <6> how do i do that <7> recompile bash? <7> raj, what OS? <6> suse <7> then you better use YaST to reinstall both readline and bash <6> it will remove all my existing bash config is in it <0> unlikely. <7> it won't remover users' dot files <7> and if you've customised /etc/profile and all, back them up <6> what abt /etc/profiles <6> ok thanks floyd_n_milan <7> np :) <6> thnks twkm <8> what if i want to make any rm command not remove the file but move it to a certain directory, will setting an alias be the solution? <0> sometimes. <0> might be simpler to replace /bin/rm. <0> though of course no program, only scripts, and people would use it. <8> i want to be un intrusive <0> then throw the idea in the trash. <8> i did.. <8> alias rm='mv $1 /root/trash/' <0> sigh. <8> but it's trying to overwrite the file im deleting with the directory /root/trash !! <0> naturally. <0> aliases don't have arguments. <8> hmmm <8> so i can't make it recognize the arguments by ANY way <8> ok may be i should create a small script to take place of rm <8> and put it in the alias list <0> alias list? what's that? <0> i suggest you replace rm with a good program, i.e., not a script. <8> i mean in .bashrc :) <8> what's the difference! a script having it take arguments putting it in /root/trash <0> aliases don't work inside other scripts. <0> if you mean to put a script somewhere in the PATH, other scripts might change the PATH and thus ignore your script. <0> heck, you might forget and change your interactive PATH such that it no longer uses the script. <0> now all that is fine by me, as long as you recognize how that limits it. <9> hi guys, how do I catch an error code returned by wget in a bash script <0> somewhat like what happens to people that ***ume rm will be aliased to rm -i, then they do ''rm *'' and find the alias missing ... and cry. <8> twkm, yeah i got your point of view <9> same thing for mpg123 <8> twkm, that's the main idea of my idea :) <0> neoalex: you can use the special parameter that holds the exit status of the last pipeline. <9> twkm: which parameter is that? <0> neoalex: ''man bash'', special parameters section.
<9> ? exit status of the last executed pipeline <9> and how do I use it? <0> any way you like. <0> test and case are common. <0> i prefer ((, unless there will be an if ladder involved, then i tend to prefer case if possible. <0> now, sometimes you don't need any of that, just use if or && or || to handle the zero vs non-zero cases. <0> e.g., program ; case $? in 0) success things;; 1) exit 1 things;; 2) exit 2 things;; *) default things;; esac <0> or, if program; then success things; else failure things; fi <0> in bash an exit status of 0 is taken to mean success, and any other value as failure. <0> so you might want to reread those with s/success/exit 0/g <10> oi <8> i did now of rm only <8> but when issuing rm -f it spits out this error <8> mv: missing destination file operand after `/root/trash' <8> could i filter the $1 and cut any rm arguments from it ? <0> yes. doesn't sound very unintrusive though. <8> :D <8> i was meaning that i won't want to cook a new rm command but just make it as simple as it could be <0> uh-huh. <0> anyway, feel free to remove options. <8> remove options? <0> yes, parse the words, discarding any that appear to be options. <8> sed or cut? any example? <0> uh. no. a loop. <8> mmm <3> umm <8> can't get it <8> could i tell awk to print all arguments above certain arg number, like in "awk '{print $3}'", i want it to print $3 and all above like $4 and $5..etc <11> Hi all, I know you can iterate over files by doing 'for $file in "$(ls)"', but is there a way to only get directories? I'm trying this script (http://rafb.net/p/P6qcKN67.html), but it appears to get the directories as one long string (separated by newlines). <7> find <7> tut tut <7> plus there's the mess with spaces in the names <7> !space <7> GAH! <7> i can't use that bot! <0> m0dY: no, but you can use a loop. <7> lasindi, look up the FAQ <0> !faq <12> No matches found at http://wooledge.org/mywiki/BashFaq <11> floyd_n_milan: ok <8> twkm, like ? <0> there's the whole faq. <7> twkm, how does one search a particular term? <0> put a word after the trigger. <8> twkm, i know how to make a loop, just can't get how will it be much helpful <7> !space <0> sigh. <7> oh <7> sorry <7> !faq space <12> http://wooledge.org/mywiki/BashFaq#faq20 -- How can I find and deal with file names containing newlines, spaces or both? <7> ah cool <7> twkm, thanks <0> i prefer to load the whole faq in my browser then use it's own toc and the browser string searching. <7> yeah i do the same <0> m0dY: loop from 3 to NF, and printf "%s" each field. <7> hmm pitfalls should be in the topic methinks <11> floyd_n_milan: I'm trying "find . -type d -print" as suggested in the FAQ, but I have the same problem as before. <8> okay <8> will'nt this be a bit slow?! <0> what do you care? <8> np <7> lasindi, use the very last solution <0> my guess is he didn't try any of the solutions, since none of them use -print. <11> I'm trying this one: http://wooledge.org/mywiki/BashFaq#head-cf4fc2a4f5a67ebb598de53ddd85bbeb7a9cbb63 <11> Maybe we're talking about different solutions. <7> look up #20 <0> the only faq link presented here is for #20, which does not use -print. <0> are you actually trying to do what #10's question suggests? <0> "recreate a directory structure, without the files" <11> No, but I'm also not trying (at least intentionally) to do what #20 suggests. <7> XY <7> what exactly do you want to do? <11> I'm trying to just get a list of the directories, without the files.
Return to
#bash or Go to some related
logs:
banshee m4a plugin dapper #gentoo #mysql #gentoo ubuntu+xvid+pixelated suse openoffice can't open doc suspend to ram linux asus a6 undefined reference to `pixelRGBA' sqlite check existence of a column named.conf keeps reverting
|
|