Home Page   #compiz-fusion  #kubuntu  #freebsd  #linux  #debian  #fedora  #gentoo  #bash  #suse  #vim  #slackware  #ubuntu  
Reliable $1 Web Hosting by 3iX

Channels


#bash

26 December 2007


Total 9 pages. You are browsing page 1/9.

First :: Prev :: [1] [2] [3] [4] [5] [...] :: Next :: Last

--- Log opened Wed Dec 26 00:00:48 2007
00:01 <****> Why does your program care about what the distribution is?
00:09 <****> ferret: for security reasons I use only hardcoded pathes to programs I use in my scripts
00:11 <****> plopix: PATH=/bin:/usr/bin:/usr/local/bin:/sbin:/usr/sbin:/usr/local/sbin ?
00:15 <****> karolisl: you mean to hard code PATH in script?
00:17 <****> plopix: yup. its a good security measure
00:18 <****> plopix: yep.
00:18 <****> plopix: sometimes scripts will be written calling each command by its absolute path for similar reasons
00:20 <****> therefore I also have to know what os I am using. for example ports on darwin hosts install apps in /opt/local/bin
00:20 <****> mildly annoying when you want your path used instead of the author's path -- e.g., testing new versions of utilities.
00:20 <****> twkm: yup but handleable
00:21 <****> using ${MY_COMMANDDIR}/command type absolute paths
00:22 <****> hence "mildly".
00:23 <****> so I use uname os detection in an makefile and use os depending pathes in my script. Thanks
00:25 * twkm chortles
00:49 * BearPerson hugs /usr/bin/env
00:58 <****> I don't remember, but is there a random function in bash?
00:59 <****> $RANDOM.
00:59 <****> /dev/random / /dev/urandom
01:00 <****> thanks
01:01 <****> hey, perfect :)
01:01 <****> now i need to find modulo in the man page and i can do stuff
01:02 <****> !faq random
01:02 <****> http://wooledge.org/mywiki/BashFAQ#faq26 -- How can I randomize (shuffle) the order of lines in a file? (Or select a random line from a file, or select a random file from a directory.)
01:11 <****> Hmm, ok. Let me try a bit better question: Is there a good way to have a script randomly select something from a hash or such, or would that be done better in a, ahem, real language?
01:15 <****> "a hash"?
01:16 <****> you mean an associative array?
01:16 <****> bash doesn't even have them.
01:16 <****> Sorry, my mistake
01:16 <****> an array was what I ment -.-
01:16 * forgottenwizard just woke up
01:16 <****> forgottenwizard
01:16 <****> forgottenwizard: http://wooledge.org/mywiki/BashFAQ#faq6 -- How can I use variable variables (indirect variables, pointers, references) or associative arrays?
01:22 <****> hi, can someone give me a little help regarding bash syntax? I'm trying to store a list of filenames in a environment variable to be passed to a for loop, but I didn't find anything to specify filesnames with spaces
01:22 <****> I tried MYFILES="file1 file\ with\ spaces", but that didn't work
01:23 <****> without the " it doesn't work too (ofcourse)
01:23 <****> \pub\bash0r
01:23 <****> \pub\bash0r: Arrays allow you to enumerate elements without the need for an explicit delimiter (like spaces). They cannot provide any 'associative' or 'hash' behavior. If you really think you need this, use awk. http://wooledge.org/mywiki/BashFAQ#faq6
01:24 <****> \pub\bash0r
01:24 <****> \pub\bash0r: Arrays RULE! See http://wooledge.org/mywiki/BashFAQ#faq5 -- Remember !$@ applies to normal arrays as well as argv.
01:24 <****> \pub\bash0r
01:24 <****> \pub\bash0r: http://wooledge.org/mywiki/BashGuide
01:24 <****> ah, arrays ... I was searching for "list" :-/
01:24 <****> thanks :)
01:24 <****> np :)
01:34 <****> i'm trying to make a script to load proxy from one file, remove cookie, start browser, sleep while page loads, kill it, and repeat loop. How can i make browser run (fork) in background so sleep runs in parralel with it. Script is at http://pastebin.archlinux.org/22298
01:46 <****> Merry Christmas everyone
01:46 <****> I'm having a small issue piping output to a file.
01:46 <****> anyone care to helo?
01:46 <****> help*
01:47 <****> !ask
01:47 <****> Don't ask to ask, or gauge for life in the channel. Just ask your question.
01:47 <****> lol
01:47 <****> Okay, so here's the deal.... Here's what I'm trying to do...
01:47 <****> $phpfile
01:47 <****> and the output is....
01:47 <****> = "down";e
01:47 <****> but if I do....
01:48 <****> echo \$$pingname' =' \"down\"\;
01:48 <****> I get
01:48 <****> $example = "down";
01:48 <****> what are you trying to achive?
01:48 <****> adn that's what I'm supposed to see in $phpfile
01:48 <****> but I don't.
01:49 <****> !xy
01:49 <****> http://wooledge.org/mywiki/XyProblem
01:49 <****> It's an X-Y problem.
01:49 <****> Kamping_Kaiser is asking for the Y.
01:49 <****> Kamping_Kaiser: I'm trying to echo stuff into a config.inc.php file with bash.
01:50 <****> Echo what, precisely?
01:50 <****> so I would use the $example variable in my php stuff
01:50 <****> So what you are trying to achieve is writing the literal string "$pingname" to a file?
01:51 <****> lol
01:51 <****> okay I get the idea
01:51 <****> Ardonik: In short
01:51 <****> yes
01:51 <****> file
01:51 <****> so $pingname = "down"; to a file
01:51 <****> Use single quotes to disable expansion.
01:52 <****> file
01:52 <****> let me try
01:53 * Kamping_Kaiser reads xy problem
01:53 <****> Ardonik: no, because $pingname is a bash variable
01:53 <****> so in the php config file I want this...
01:53 <****> $bash-variable = "down";
01:54 <****> file ?
01:54 <****> I.e., you *want* $pingname to be expanded.
01:54 <****> that doesn't work, because it echos "$pingname" to the file.
01:54 <****> I want the variable assigned to $pingname to be piped to the file
01:55 <****> so if $pingname was "test
01:55 <****> No it doesn't.
01:55 <****> I would want the file to be like.... $test = "down";
01:55 <****> see what I mean?
01:55 <****> No, not yet.
01:55 <****> hold on sec
01:56 <****> file; # will write [foo = "down"] to the file
01:56 <****> You claimed that pingname won't be expanded in the above--I daresay that's not correct.
01:56 <****> s/won't/wouldn't/
01:56 <****> nevermind Ardonik I got it
01:56 <****> Okie dokie.


Total 9 pages. You are browsing page 1/9.

First :: Prev :: [1] [2] [3] [4] [5] [...] :: Next :: Last