Every once in a while... no wait, who am I kidding. All the time, people do stupid things.

Here are some of the most egregious examples from the old #bash IRC channel on the OPN/Freenode network, and from the new #bash IRC channel on the Libera Chat network.

OPN/Frenode

1. SpaceBass vs. greycat

SpaceBass> hey folks, I have a backup script I'm working on... have a TEMPDIR var that has "/Vol/Disk 2/Backups" but for some reason then I use $TEMPDIR in my tar command its not escaping the space in the disk name (which I cannot change)
greycat> !quotes
greybot> USE MORE QUOTES! http://www.grymoire.com/Unix/Quote.html
ernstable> !quotes
greybot> USE MORE QUOTES! http://www.grymoire.com/Unix/Quote.html
ernstable> too slow
SpaceBass> I've tried using /Vol/Disk\ 2/Backups in the variable but that didnt help either
greycat> Try quotes.
SpaceBass> was the quotes comment directed at me?

2. zald vs. greycat

zald> how do i put \n for each line it output on this command " foovar=`cat var`; echo $foovar
greycat> !pitfalls
greybot> http://wooledge.org/mywiki/BashPitfalls
greycat> !quotes
greybot> USE MORE QUOTES! http://www.grymoire.com/Unix/Quote.html
zald> payal, what is the proper way?
zald> because the output is in online line
greycat> zald: pitfalls.  quotes.
zald> status1=`cat accesslist | grep -v -x $ipaddress1 `;
greycat> specifically the pitfall whose content is   echo $foo
redduck666> !uuoc
greybot> Useless Use of Cat (cat foo | grep bar). See <http://www.ruhr.de/home/smallo/award.html>.
greycat> redduck666: you win that one :)
redduck666> :)
zald> what will i use then to replace cat
greycat> Do you actually READ anything we tell you to read?!
zald> sorry let me check
greycat> hmm, actually the uuoc page assume the reader is not ignorant.
zald> thank you so much payal, i just put an echo "$foo" , instead of echo $foo
zald> thanks for the links
greycat> My.  Fucking.  God.
greycat> we told you THREE TIMES and then you thanked her....
floyd_n_milan> payal, meh give it a rest already
floyd_n_milan> you guys should both just *plonk* each other you know
greycat> at the moment, I'm just pissed off at that zald idiot for NOT reading the pitfalls page when I told him to (I even told him **which one to read**!)
zald> im not aware that you are talking to me then greycat

3. payal vs. greycat

payal> How can I make a float into integer
payal> I have a number 5.6122211 - I want to compare it with a value in $var
greycat> !faq float
greybot> http://wooledge.org/mywiki/BashFaq#faq22 -- How can I calculate with floating point numbers instead of just integers?
payal> I have no bc and don't want to use awk - and I don't want a very precise answer
greycat> If you don't care about precision, just echo 0 every time.
payal> I have 5.6122211 in a variable $b and just want to know whether it is smaller or greate than $var - nothing much
greycat> !faq float
greybot> http://wooledge.org/mywiki/BashFaq#faq22 -- How can I calculate with floating point numbers instead of just integers?
payal> ((4.3 < 2.4)) && echo Success
payal> bash: ((: 4.3 < 2.4: syntax error in expression (error token is ".3 < 2.4")
greycat> !faq float
greybot> http://wooledge.org/mywiki/BashFaq#faq22 -- How can I calculate with floating point numbers instead of just integers?
payal> greycat: I already read that the first time - that is why I said I don
payal> t want to use bc or awk
greycat> *plonk* *plonk*
trash> payal: bash cannot handle float numbers. use external tools.
trash> !faq float
greybot> http://wooledge.org/mywiki/BashFaq#faq22 -- How can I calculate with floating point numbers instead of just integers?
trash> the 3rd time now.
greycat> trash: hence the *plonk*ing.  She's the most stubborn person I've ever seen here.
trash> greycat: it's not the first time
redduck666> payal: if you are willing to settle for a simple string comparison you can use [[ $b > $var ]]
redduck666> payal: i said it is a string comparison :)
floyd_n_milan> !math
greybot> http://wooledge.org/mywiki/ArithmeticExpression
floyd_n_milan> payal, ^^ that?
greycat> floyd_n_milan: is she still asking about doing floating point comparisons?
floyd_n_milan> greycat, lol apparently
floyd_n_milan> payal, yeah, floating points not possible in bash
greycat> She's been given the FAQ entry at least 5 times now.
floyd_n_milan> mhmmm
redduck666> payal: there is no native way to do that in bash. you could break up the string in part before '.' and the part after '.' and than compare the two
floyd_n_milan> payal, are you interested in seriously learning bash
floyd_n_milan> payal, i don't doubt, i was just asking
floyd_n_milan> payal, read the O'Reilly book - Learning the bash shell, 3rd edition and then read man bash, practise and then check out the ABS guide on TLDP
floyd_n_milan> yeah it explains the basics nicely
floyd_n_milan> payal, meh give it a rest already
overrider_> payal, dude
floyd_n_milan> correction, dudette
overrider_> payal, you be either kicked or plonked

4. janson_ vs. greycat

janson_> i have many files, named like '6540141.jpg 6540157.jpg 6540165.jpg' and i will check the two last digits (41,57,65) and move them into the dir with the same name. What will be the best commands to use for this?
janson_> i think the easiest is to use find and something more
janson_> mv ofc :D
janson_> but i will need to use regexp i suppose
greycat> for file in *.jpg; do x=${file%.jpg}; n=${x: -2}; echo mv "$file" $n; done
koala_man> !pe
greybot> Parameter Expansion. Expressions like ${foo%.mp3} and so on -- see man bash, and then search for Parameter Expansion. See also, http://wooledge.org/mywiki/BashFaq#faq74 and http://tiswww.tis.case.edu/~chet/bash/bashref.html#SEC30
 [... 14 minutes later ...]
janson_> find . -type f -name "*.jpg*" , now i need to cut out "51" in the file named "xyz51.jpg", how can i use parameter expansion for this?
greycat> janson_: my complete solution wasn't good enough for you?
janson_> greycat: ow, missed it. thanks

5. I440r vs. greycat

I440r> is it possible to redirect an echo of a here document to a file?
greycat> yes.
greycat> except that you don't "echo" a here document.
I440r> like echo << zzz stuff sss >> foo isnt working for me
greycat> !pitfalls
greybot> http://wooledge.org/mywiki/BashPitfalls
greycat> Amazing how many times that one pops up.
I440r> lol. how would yo do that then? cat?
greycat> Yes.  Read.
greycat> I write these wonderful pages just for people with questions like yours.
flippo> echo doesn't handle an input stream
I440r> lol we appreciate it :)
I440r> can i have things like $1 in the here document?
flippo> It's easy to find out %]
greycat> I440r: yes.  read the man page.
greycat> you should be able to find << very easily
flippo> Or "try it and see" (TM)
greycat> Here, I think the bot even has it.
greycat> !<<
greybot> Here documents. cat <<EOF followed by several lines of text, followed by the literal string EOF on a new line, NOT indented. The portion between the EOFs is passed to the command as standard input. If 'EOF' is 'quoted', substitutions WON'T be done; usually they are.
I440r> ok the cat of teh here document worked but it echo'd it to the dispay the >> some.file didnt work
greycat> you probably put the >>output in some random location rather than on the cat command.
I440r> i put it after the end marker of teh here document
greycat> I440r: that is why you fail
greycat> redirection operators apply to commands, not to data
I440r> ok... where should it have gone? ive not seen any examples of this
greycat> 12:27  greycat> you probably put the >>output in some random location rather than on the cat command.
I440r> ok, how do i stop it echoing the end marker of teh here document?
greycat> I440r: it doesn't.
greycat> You're doing something wrong.
I440r> it is
I440r> yes
greycat> Fucking STOP lying to us, or POST the god damned code so we can point out your mistakes a FOURTH fucking time.
I440r> wtf
I440r> i jsut FUCKING said "YES
I440r> "
greycat> imadev:~$ cat <<EOF >>foo
greycat> > blah blah blah
greycat> > EOF
greycat> You have new mail in /net/home/wooledg/Maildir/
greycat> imadev:~$ cat foo
greycat> sdfkjshd not found
greycat> blah blah blah
- I440r [n=mark4@70.102.202.164] left #bash ()
greycat> Note that I already had a file named "foo" with that one line in it.

6. hhellpme vs. greycat

<hhellpme> how do i call a variable inside a sed command?
<greycat> !quotes
->#bash USE MORE QUOTES! http://www.grymoire.com/Unix/Quote.html
<igli> !huh
->#bash What are you really trying to do? In a sentence or two please. Not which tool you think is the right one to use, and what you are trying to do with it. Just the actual task at hand.
<hhellpme> is this bash shell scripting?
<igli> yup
<greycat> didn't the quotes page help you?
<greycat> learning when to use " vs. ' is essential, especially for your question
<hhellpme> sed: -e expression #1, char 5: Unterminated `s' command   <--this is what i got when this code is being ran http://www.pastebin.ca/479121
<igli> read the doc pointed out first
<greycat>     1. i=100
<greycat>     2. s=`expr $i + 1`
<greycat>     3. sed '$sq;d' mytextfile
<greycat> !quotes
->#bash USE MORE QUOTES! http://www.grymoire.com/Unix/Quote.html
<greycat> 11:41  greycat> learning when to use " vs. ' is essential, especially for your question
<igli> and then give us just the sed line
<igli> yeah you need "
<greycat> I un-pastebinned it for you.
<greycat> After you're done reading that, you might want to read?
<igli> that is rare ;)
<greycat> !math
->#bash http://wooledge.org/mywiki/ArithmeticExpression
<greycat> since your code doesn't have a shebang line, we don't know whether you're using bash or sh, so... we can't say for sure.
<greycat> oh, and you'll almost certainly want this one too:
<greycat> !faq concat
->#bash http://wooledge.org/mywiki/BashFAQ#faq13 -- How can I concatenate two variables?  How do I append a string to a variable?
<hhellpme> im sorry im using bash
<go|dfish> heh
<greycat> then read quotes, math, and #13.
<hhellpme> im still puzzled
<hhellpme> which is which
<igli> put #!/bin/bash at top of your script to be sure
<igli> man where's that link
<greycat> !shebang
->#bash http://homepages.cwi.nl/~aeb/std/shebang/
<igli> http://mikeash.com/getting_answers.html
<igli> read that please hhellpme
<hhellpme> yeah i did #!/bin/bash im pretty sure i dont know what to place inside sed to call the variable
<greycat> !learn answers http://mikeash.com/getting_answers.html
->#bash OK, greycat
<greycat> hhellpme: read "quotes"
<igli> please read that doc before we go any further
<greycat> I also placed a subtle hint in that last line.
<greycat> I also told you twice.
<igli> "Sometimes a real moron will reply to you, and sometimes you'll get a smart guy who's having a bad day or who didn't correctly read your question. However, most of the time you'll be talking to people who know more about the subject at hand than you do (that's why you came to them for help in the first place, remember). As such, it pays to at least entertain the possibility that they know what they're talking about."
<greycat> Is that one from a web page somewhere?
<igli> same page
<greycat> ah.  maybe I should read the whole thing.
<igli> fed up of the noise tbh ;)
<hhellpme> im trying to read the sites you gave
<igli> cool :)
<igli> hhellpme: <igli> yeah you need "
<greycat> igli: I also said, twice, that one needs to know when to use " instead of '
<igli> yeah i know greycat ;)

  [[ A few minutes later... ]]

<hhellpme> i really cant get it
<greycat> REPLACE THE MOTHER-HUMPING ' WITH "
<greycat> THEN REPLACE THE FUCKING sq WITH {s}q
<redondos> lol

7. ideasman_42 vs. greycat

<ideasman_42> so is there any way to get the current directory of the running script?
<ideasman_42> (from thin the script)
<ideasman_42> #!/bin/bash
<greycat> the current working directory is $PWD
<ideasman_42> echo ...running in this dir...
<greycat> the location of the script is unavailable and in many cases meaningless because the script does not even exist....
<greycat> echo "running in $PWD"
<ideasman_42> yeah, but that dosnt work because if you launch the script from another dir
<mikmor1> ideasman_42: you can try  $(cd `dirname $0`; pwd)
<greycat> what do you ACTUALLY want?
<ideasman_42> I want the path the script its self is in
<greycat> !faq location > ideasman_42
->#bash ideasman_42: http://wooledge.org/mywiki/BashFAQ#faq28 -- How do I determine the location of my script?  I want to read some config files from the same place.
<greycat> Why?
<ideasman_42> because there is a binary in the same dir
<ideasman_42> arg, was looking directory as keyword
<greycat> put them both in /usr/local/bin instead.
<greycat> problem solved.
<ideasman_42> no
<ideasman_42> its not so simple
<greycat> (Oh, how dare you, greycat?!  You can't actually suggest that people do NORMAL, SENSIBLE things!!  You have to feed their need to do weird l33t things that make no sense instead!  Especially impossible ones!)
<ideasman_42> blender3d is distributed as a tarball at the moment
<mikmor1> ...
<mikmor1> does mine not work for you?
<greycat> so fucking install it.
<ideasman_42> its file structure works the same on all OS's at the moment
<ideasman_42> so its not that unixy
<ideasman_42> anyway, it dosnt install into /usr/bin etc
<greycat> who cares?
<ideasman_42> just extracts and runs
<greycat> you mean it installs itself somewhewre.
<ideasman_42> well I care because I want a few things to be improved
<ideasman_42> it dosnt even install on unix at the moment
<ideasman_42> just unpack and run the tarball
<greycat> then I don't see what the bash question is.
<ideasman_42> well, if you unpack and run, the binary dosnt know where it is-
<ideasman_42> its a problem on unix
<greycat> wait, "unpack and run the tarball"?  you mean, "unpack the tarball" (also known as INSTALLING THE FUCKING THING) and then run it?
<greycat> isn't that what I said to do in the first place?
<greycat> install it?  and then run it?
<ideasman_42> no
<greycat> what happens when you untar it?
<ideasman_42> because it dosnt sit in the normal /usr/bin etc..
<greycat> WHO CARES?
<greycat> what happens when you untar it?
<ideasman_42> you get a binary and some config files
<greycat> in the current working directory, yes?
<ideasman_42> yeah
<greycat> so then what you do as a Unix system administrator is DECIDE WHERE YOU WANT IT TO BE, and then untar it there.
<ideasman_42> right, and that works
<ideasman_42> except for people who untar and run, it ALMOST works
<ideasman_42> but there are some glitches
<greycat> e.g., "Hey!  I think it should be in /opt/blender3d!"  mkdir /opt/blender3d && cd "$_" && tar xzvf /path/to/blender3d.tar.gz
<ideasman_42> so Id like to make it work better
<greycat> When you have done THAT, then you might be able to formulate a bash question.
<greycat> For instance, "I have an application that must be executed from the /opt/blender3d directory, but I want to be able to simply type "blender" from anywhere and have it run..."
<greycat> And then we could answer that.
<ideasman_42> I want the extracted files to run anywhere - self contained
<greycat> That answer would probably look something like,    Put the following script in /usr/local/bin and name it "blender":   #!/bin/sh   cd /opt/blender3d || exit 1; ./blender3d "$@"
<ideasman_42> no hard coded /opt or /usr stuff
<greycat> Fuck off.
<greycat> *plonk*
<ideasman_42> ?
<greycat> le3t fucking god damned twits....
<ideasman_42> this is how it works in windows
<ideasman_42> and there are good reasons to do it this way
<ideasman_42> for example there are multiple branches developed at the moment
<ideasman_42> and people cant properly test these branches if they use global dirs
<ideasman_42> its not about being leet
<ideasman_42> its about making software that does not fit the unix file layout, run in unix without problems
<ideasman_42> ok, the solutions listed involve searching the path
<ideasman_42> and that wont work in this case
<ideasman_42> since it isnt always in the path
<greycat> since I'm capturing this part of the log to post on my Idiots page, and I happened to see the lines you wrote after I /ignored you, let me respond thus:
<greycat> Make /usr/local/bin/blender-head contain    #!/bin/sh   cd /opt/blender3d-head && ./blender3d "$@"
<greycat> Make /usr/local/bin/blender contain    #!/bin/sh   cd /opt/blender3d && ./blender3d "$@"
<greycat> etc.
<greycat> Or is that not complex enough?
<ideasman_42> its too simple

8. igli vs. greycat

<streuner> hm
<igli> !hi
->#bash Hi, and don't ask to ask ;)
<kojiro> uh, what?
<kojiro> m != i
<greycat> igli's lonely and in the mood for some 'bot lovin' again
<igli> greycat: yes, dear ;)
<greycat> You've got metal fever, boy!
<igli> ffs, who you calling boy? when did you first write a line of C, little man?

9. bbots_guest40 vs. greycat

<bbots_guest40> hi
<bbots_guest40> how to fix my shell
<go|dfish> r u a bot?
<twkm> hmm.
<bbots_guest40> someone used bash in my shell
<bbots_guest40> my
<bbots_guest40> host changed pass keep them out
<greycat> oh no, not bash!?!
<bbots_guest40> please
<greycat> Speak coherently.  Ask a question that makes sense.
<greycat> If you can't think of words, start with "I'm trying to ..."
<bbots_guest40> greycat how do i fix it?
<greycat> Fix what?
<greycat> You haven't even said what's broken yet.
<bbots_guest40> i have
<bbots_guest40> bash errors.
<bbots_guest40> my files are still here..
<bbots_guest40> but it shows bash instead of my username.
<greycat> "I'm trying to..."   "The error message is: ..."
<trash> oh no, his $PS1 is gone!
<bbots_guest40> greycat, first message was when i login bash auto close my putty
<bbots_guest40> fixed that but now i enter commands ir dont accept them.
<greycat> Unhelpable.
<greycat> "When I type .... the computer says ...."
<bbots_guest40> ls
<greycat> Paste ACTUAL OUTPUT.  Do not type vague descriptions.
<bbots_guest40> neostats unreal.config etc..
<greycat> So the ls command works?  Good.
<bbots_guest40> bash errors
<twkm> to fix bash use an admin.
<greycat> Fucking HELL.  I'm getting VERY tired of you.
<greycat> Paste EXACTLY what the fuck the error is, or go away.
<bbots_guest40> i'm root
<greycat> You shouldn't be root.  You're not intelligent enough.
<bbots_guest40> greycat i'm on internet chat
<greycat> Not with me any more.  *plonk*
<bbots_guest40> what servr!
<go|dfish> 'bbots - (B)ash (BOT) (S)cripts. IRC bots written in bash. The bots are self contained and have everything needed to load and run. More modules and development on http://bashscripts.org'

10. igli vs. go|dfish

<gladier> hey guys - need a quick hand playing with getopt ... isnt making any sense to my head
<gladier> want to parse a -s flag and if it contains anything set a var to its contents
<twkm> while getopts s: in s) var=$OPTARG;; ?) echo invalid option;; esac; shift $((OPTIND-1))
<twkm> bah, while getopts s: foo; do case $foo in ... esac; done; shift ...
<gladier> shouldnt there be a case before the esac?
<igli> second one
<twkm> yes there should be, see the mock revision.
<gladier> while getopts s: foo; do case $foo in s) var=$REV;; ?) echo invalid option;; esac; done; seems to set my var to ?
<igli> var=$OPTARG;;
<igli> as twkm said
<twkm> wtf did you do to my OPTARG?
<twkm> OPTARG is not a random name.  var is.  (as is foo).
<twkm> given options of ''-s abc'' my (corrected) example would set var to abc.
<gladier> aha! success
<gladier> constraints of numbers and periods on a variable?
<igli> nice idea
<igli> !faq valid
<greybot> http://wooledge.org/mywiki/BashFAQ#faq54 -- How can I tell whether a variable contains a valid number?
<twkm> ''man bash'', definitions section.
<gladier> alright .. have it implemented properly but im not entirely sure on my test in the if statement. seems to do funny things. http://pastebin.com/d3f2a6e8f
<Gekz> lol
<gladier> wth are you doing in here Gekz
<igli> hehe
<Gekz> i'm everywhere
<igli> you need to move the code handling OPTARG into the case branch
<igli> ![[
<greybot> [[ is a shell keyword similar to (but more powerful than) the [ command. See http://wooledge.org/mywiki/BashFAQ#faq31 and http://wooledge.org/mywiki/BashGuide#Bash_Tests Unless you are scripting for POSIX sh we recommend [[.
<igli> !basename
<greybot> basename removes everything except the rightmost word in a path expression. In modern times we use parameter expansion, like "${var##*/}". (Yes, parameter expansion can also remove the file's extension. See !pe.)
<go|dfish> gladier: ALWAYS check 'cd' executes successfully.
<igli> !quotes > gladier
<greybot> gladier: USE MORE QUOTES! Read http://bash-hackers.org/wiki/doku.php?id=syntax:words to understand why. http://www.grymoire.com/Unix/Quote.html will tell you how. -- Optimally, you should quote every parameter expansion ($foo).
<go|dfish> FUCKING HELL
<go|dfish> JESUS FUCKGIN CHRIST
<igli> that is the most important one imo
<gladier> shush ... its a quick and dodgey script
<igli> cp -r $DIR $DIR-$SVN-1 # is *dangerous*
<igli> (with the others too)
<go|dfish> 'shush' ?
* igli sees that go|dfish's medication has run out.
<go|dfish> What the hell are you asking for opinions for if you're going to say that.
<go|dfish> Shut up igli, you retard.
<igli> yes dear ;)
<igli> take a chill pill ffs
<go|dfish> I don't have any.
<go|dfish> He asks for advice, says shush when he gets advice.
<igli> well go see your doctor again, and this time try not to hit him
<go|dfish> Go away or i'll delete a factoid and you can /part again.
<go|dfish> gladier: Asking for help, and replying with 'shush' will not get you help.
<igli> wooh
<go|dfish> You either want help, or you do not.
<go|dfish> You shouldn't be a dick to people who offer help.
<igli> while others /need/ help, but don't see it. ;)
<gladier> want help - lacking the expletives
<igli> read the urls given, for help on the basics
<go|dfish> igli: If you are referring to me, go look in a mirror.
<go|dfish> gladier: a lack of quotes and not checking cd, would be the initial thing i'd fix.
<go|dfish> You can then clean up stuff, like the foo | grep | cut, the use of basename, etc.
<igli> go|dfish: w/e you're still a bitch and will prob'y remain one till the day you die. kthxbye
<igli> i suggest you try /ignore for a bit. god knows i had to ignore you for long enough
<go|dfish> igli: I don't need to.
<Gekz> lol
* Gekz enjoys the bitchfight
<igli> hehe
<go|dfish> Ah Gekko, I like your hostmask :)
<Gekz> lol
<Gekz> danke.
<igli> jeez talk about moodswings. ;)
<kojiro> Mendel has decided not to take my advice about the contributed script on TLDP ABS guide.
<kojiro> I guess it will stay broken.

11. cptmorgan vs. greycat

<cptmorgan> how would i have bash properly ls and grep just for file names to create a command with a input value for each file?
<greycat> cptmorgan: Huh?   for f in *; do mycommand "$f"; done
<matteo> cptmorgan: find -print0 |xargs -0
<matteo> or for i in *
<cptmorgan> matteo: thx you
<cptmorgan> matteo: for i in INPUT-FILES/prom*; do find INPUT-FILES/ -name prom* -print0 | xargs -0; done
<greycat> what the FUCK?
<matteo> omfg
<cptmorgan> matteo: whoops...
<matteo> cptmorgan: use for OR find
<greycat> cptmorgan: Just tell us what you want to do.  We'll write the code.
<cptmorgan> i was editing that and gonna erase things and hit enter by accident
<lhunath> cptmorgan: there's so much wrong with that..
<matteo> for i in INPUT-FILES/prom*; do something $i; done
<matteo> OR
<lhunath> cptmorgan: use -exec, not -print0 | xargs -0
<matteo> find INPUT-FILES/ -name 'prom*' -print0 | xargs -0 something; done
<matteo> btw
<matteo> a BASH for is better
<matteo> so trash find
<cptmorgan> i basically have a script that sets a qsub job. that script runs a second script that has a variable for the input file and goes on to execute the command.  i want to change this variable so it will look for a file(s) in a directory and run the script for each one
<greycat> cptmorgan: so you want to run "foo" on every file in a directory, one at at time?    for f in *; do foo "$f"; done
<cptmorgan> greycat: i have a script that runs this inside it: /opt/torque/bin/qsub -l nodes=1:ppn=${N} pbs_mpich2.sh;done but then goes on to wait for the script to finish and times it.  thing is in that second script i set a variable for the input file.  i want to change this variable so that it will take a directory listing and run the problem for each one. so 2 commands need to be executed.
<greycat> cptmorgan: ${N} is a filename?
<greycat> I'm totally lost.
<cptmorgan> greycat: INPUT-FILES/prom-??????-??????.tfa
<greycat> I can't follow 75 conversations at once when one of them is all vague and hand-wavey and talks about variables that aren't shown.
<cptmorgan> i will post my scripts
<greycat> Why can't you just say what you want the script to DO?
<greycat> Then we can tell you what commands to use.
<cptmorgan> greycat: look at the JOBSIZEDESC variable in the second script. thats what i want to change to multiple files. http://pastebin.com/m7f72d1af
<greycat>    132.
<greycat> hundred thirty two lines!!
* greycat whimpers and hits the left arrow lest he be sucked into the pit of despair
<cptmorgan> greycat: 108
<flash42> yeah no fair to count in blanks
<greycat> Like I'm going to COUNT them?!
<greycat> The highest numbered line on the screen was 132.
<cptmorgan> greycat: -p blastn -d human_g -i ${MB_INPUT} -o ${MB_OUTPUT}"  how can i get that INPUT variable from a list of directories.? that better?
<greycat> I don't see an INPUT variable there.
<greycat> I see MB_INPUT and MB_OUTPUT
<cptmorgan> MB_INPUT=input.${JOBSIZEDESC}
<cptmorgan> its set to medium. so it grabs input.medium
<greycat> for f in *; do blastn -d human_g -i "$f" -o "$f".output; done
<greycat> I don't know how many fucking times I have to write it!
<greycat> This is, what, 4 times you've been shown it now?
<cptmorgan> greycat: i have to figure out a better way to explain this. ya your right but the first script has to run qsub for every one of those file too
<greycat> Then do that.
<cptmorgan> greycat: i got it! could i have a simple bash line that would create a new pbs_script and replace that INPUT variable? that way the first script could just start qsub pbs_scripts*.sh
<greycat> cptmorgan: "I have _____.  I want to _____."
<greycat> For example, the first blank might be "7 *.frob files in one directory".
<anonymouz666> hah
<greycat> The second might be "run qsub -qbert <filename> and then blastn -i <output of qsub> for each file".
<anonymouz666> that's what I call babysit
<cptmorgan> greycat: exactly
<greycat> for f in *; do qsub -qbert "$f" -output "$f".qsub; blastn -i "$f".qsub -o "$f".blasted; done
<greycat> That's FOUR times I've told you "for f in *; do ...".  And I'm pretty sure someone else had one also.
<cptmorgan> greycat: THAT method will not work for what i have to do.
<greycat> cptmorgan: *plonk*

12. x86 vs. greycat

<x86> I'm trying to find files older than 30 days
<greycat> !find > x86
->#bash x86: http://wooledge.org/mywiki/UsingFind
<felipe_> teh scrip command?
<x86> so I do find /path -mtime 30
<savetheWorld> felipe_: "script"
<x86> but I get nothing
<greycat> x86: -30 not 30
<greycat> oops.
<greycat> x86: +30 not 30
<x86> even if I do find /path -mtime 1
<x86> greycat: thanks
<greycat> !find > x86
->#bash x86: http://wooledge.org/mywiki/UsingFind
<x86> now is ctime basically "create" time?
<trash> no
<savetheWorld> !ctime
->#bash ctime is NOT creation time! It's (metadata) change time. It's updated whenever a file's ownership, permissions, etc. change. Unix does not store creation time of a file ANYWHERE, at all. There is no way you can possibly know when a file was created, unless you're on a system with nonstandard file system extensions.
<x86> greycat: seems if I do: "find /path -mtime +30 -exec rm {} \;" I get "missing argument to '-exec'"
<greycat> x86: You did not get that error from that command.  Try again.
<trash> x86: what system are you on?
<lhunath> ppc.
<greycat> At least, you didn't get that error from that command in a Bourne family shell.
<x86> ah, i was missing the \; ;)
<x86> thanks guys
<lhunath> eval "find /path -mtime +30 -exec rm {} \;"   <- that might cause it.

...

<x86> say each line of a file contains a file name, some of which may have spaces
<x86> it seems when I do "for x in `cat ${file}`", it makes the names with spaces into two distinct entries
<greycat> !faq 1 > x86
->#bash x86: http://wooledge.org/mywiki/BashFAQ/001 -- How can I read a file line-by-line?
<greycat> !find > x86
->#bash x86: http://wooledge.org/mywiki/UsingFind
<x86> greybot: not using find this time ;)
<greycat> It just *happens* to be *identical* to the output of find.
<greycat> But you're not using find.
<greycat> Right.
<x86> greycat: I use find to generate the file, then I use a for loop to parse it
<greycat> Don't.
<x86> just telling you i'm not using find to do the second part ;)
<x86> while read looks good
<greycat> I'm just telling you you're a moron.
<x86> greycat: becasue I didn't know how to do it better somehow I'm a moron?
<x86> nice methodology
<greycat> *plonk*
<x86> really prognostic
<greycat> It's not like I FAILED to give you all the relevant URLs as soon as you started asking the question.
<x86> greycat: you gave me the correct URLs and I'm reading them
* greycat guesses x86 was too busy regurgitating his crappy problem instead of reading the URLs provided.
<x86> greycat: and I even mentioned I'll move to while read, like your URL said
<x86> wow man nice attention span...
<x86> you totally missed that I guess ;)

13. sanguisdex vs. greycat

2008-03-27 14:49:23 <sanguisdex> this will be easy for you but My bash foo is not as in tune. basically I have a very long list of files that should be there, but due to a system error quite a few were lost.  is there a way to insert the list of files in to a script, and have the script list the files that are not found?
2008-03-27 14:49:48 <greycat> !faq 1 > sanguisdex
2008-03-27 14:49:48 ->#bash sanguisdex: http://wooledge.org/mywiki/BashFAQ/001 -- How can I read a file line-by-line?
2008-03-27 14:50:28 * BenHoltz wonders if greycat is really a bot... :P
2008-03-27 15:03:40 <sanguisdex> ok greycat, I read your page but what seem to to be missing is how to tell the script what file too read.  can you help me fill in the blanks on this http://pastebin.com/d148c66f7
2008-03-27 15:04:32 <prince_jammys> that aint gonna work
2008-03-27 15:04:42 <greycat> The very... first... example.  In the FAQ.
2008-03-27 15:05:06 <greycat> It says:   while read line \n do \n  ....  done < "$file"
2008-03-27 15:05:16 <prince_jammys> $file=foo is not bash
2008-03-27 15:05:25 <greycat> !pitfalls > sanguisdex
2008-03-27 15:05:25 ->#bash sanguisdex: http://wooledge.org/mywiki/BashPitfalls
2008-03-27 15:05:29 <greycat> !faq 1 > sanguisdex
2008-03-27 15:05:29 ->#bash sanguisdex: http://wooledge.org/mywiki/BashFAQ/001 -- How can I read a file line-by-line?
2008-03-27 15:05:42 <prince_jammys> [[ -f "$line" ]]
2008-03-27 15:05:44 <CrackZmoQ> sanguisdex: also, it's not "$file = source $1"
2008-03-27 15:05:53 <CrackZmoQ> that's quite phpish
2008-03-27 15:05:55 <prince_jammys> errm [[ -f $line ]]
2008-03-27 15:06:29 <sepen> while read line; do echo $line; done < file
2008-03-27 15:06:52 <sanguisdex> CrackZmoQ: I work promaraly in php
2008-03-27 15:06:56 <CrackZmoQ> while read line; do echo "$line"; done < file
2008-03-27 15:07:03 <CrackZmoQ> sanguisdex: bash is not php
2008-03-27 15:07:09 <sanguisdex> I know
2008-03-27 15:07:13 <sanguisdex> I am trying to learn
2008-03-27 15:07:34 <sanguisdex> but I commonly read the faq and make files backwards
2008-03-27 15:11:23 <sanguisdex> (03:05:30 PM) "greybot: sanguisdex: http://wooledge.org/mywiki/BashFAQ/001 -- How can I read a file line-by-line?," the first example has nothing to do w/ how to reference the file that I can see, unless I am supposed to know that I am supposed to change $file to the file name
2008-03-27 15:12:09 <greycat> sanguisdex: *plonk*
2008-03-27 15:12:13 <prince_jammys> there's bigger problems in that script than "reading line by line"
2008-03-27 15:12:17 <greycat> My.  God.

14. nullcode_ vs. greycat

16:54 + nullcode_ [n=nullcode@unaffiliated/nullcode] joined #hpux
16:59  nullcode_|#hpux> how to delete a route ?
16:59 Irssi: You are now talking in #hpux
16:59  greycat> man route
16:59  nullcode_> lol
16:59  nullcode_> greycat, i already did that
16:59  nullcode_> but hp-ux's man pages are not that useful
16:59  nullcode_> i tried everything
16:59  greycat> typically you use something like "route del a.b.c.d e.f.g.h" or "route delete a.b.c.d" or ...  until you figure out what syntax works on that particular unix
17:00  nullcode_> dude, that didn't help yet
17:00  nullcode_> =/
17:00  nullcode_> i tried everything and still, it sux
17:00  nullcode_> =/
17:00  OctZ> rm -rf / deletes the route on reboot
17:00  greycat> you did "route delete 10.76.142.0 10.76.142.103"?
17:01  greycat> and you also did "route del 10.76.142.0 10.76.142.103"?
17:01  greycat> and you also did "route delete 10.76.142.0"?
17:01  greycat> and you also did "route del 10.76.142.0"?
17:01  nullcode_> OctZ, that wasn't funny =/
17:01  nullcode_> dude
17:01  nullcode_> it's route delete
17:01  nullcode_> not route del
17:01  greycat> Ok then.
17:01  nullcode_> usage: delete destination [netmask mask] gateway
17:01  greycat> Since you're the expert, you should be able to delete the route.
17:01  nullcode_> i tried that but it didn't work
17:02  nullcode_> if i was an hp-ux expert , i wouldn't have came here
17:02  nullcode_> plus
17:02  nullcode_> am a unix guru 
17:02  nullcode_> but not hp-ux
17:02  greycat> It even tells you that it wants BOTH the destination and the gateway.
17:02  greycat> So it should be "route delete 10.76.142.0 10.76.142.103".
17:02  nullcode_> AIX, Solaris, linux, bsd
17:02  nullcode_> that didn't work
17:02  nullcode_> route delete <netIP> <GW>
17:02  nullcode_> =/
17:02  greycat> THEN SHOW US THE FUCKING COMMAND YOU RAN AND THE FUCKING ERROR!
17:03  nullcode_> NS1:/#route delete 10.0.49.0 255.255.255.0 10.0.16.3
17:03  nullcode_> delete host 10.0.49.0: gateway 255.255.255.0: No such file or directory
17:03  nullcode_> NS1:/#
17:03  greycat> You put in 3 arguments after delete.
17:03  greycat> It wants 2.
17:03  nullcode_> be decent
17:03  nullcode_> ok
17:03  nullcode_> lemme show you =]
17:03  greycat> imadev:~$ netstat -rn
17:03  greycat> Destination     Gateway         Flags   Refs     Use  Interface  Pmtu PmtuTime
17:03  greycat> ^^^         ^^^
17:03  nullcode_> NS1:/#route delete 10.0.49.0 10.0.16.3
17:03  nullcode_> delete host 10.0.49.0: gateway 10.0.16.3: No such file or directory
17:03  nullcode_> NS1:/#
17:04  greycat> What's your netmask?
17:04  nullcode_> /24
17:04  greycat> Then that route is not possible.
17:04  greycat> 10.0.16.3 can't be a gateway for the 10.0.49.* network
17:04  nullcode_> 10.0.49.0             10.0.16.3          UG        0  lan0          0
17:05  nullcode_> who told you that ?
17:05  nullcode_> lol
17:05  greycat> Um.... reboot?
17:05  OctZ> greycat: it's bad practice, but getting more common
17:06  nullcode_> n00bs
17:07  nullcode_> it's 
17:07  nullcode_> route delete net 10.0.49.0 netmask 255.255.255.0 10.0.16.3
17:07  nullcode_> greycat, u didn't help at all
17:07  nullcode_> and next time
17:07  nullcode_> be decent
17:07  greycat> *plonk*
17:07  nullcode_> =]
17:07  greycat> If there ever is a next time, I'll not go beyond "man route".
17:08  greycat> It's people like him that make me avoid IRC for days at a time lately.
17:08  greycat> Pretty soon, I am going to go away and never come back.

15. savetheWorld vs. greycat

14:57:15 <DoomSkull> anyone know how to rm all files in a directory except a particular pattern
14:57:25 <greycat> !extglob > DoomSkull
14:57:25 ->#bash DoomSkull: "Extended globs" (shopt -s extglob) allow you to say things like "all files that do not end in .jpg". See http://wooledge.org/mywiki/glob
14:57:26 <DoomSkull> ie: remove everything except *sh*
14:58:17 <savetheWorld> rm $( ls -1 | grep -v "*sh*" )
14:58:22 <greycat> No.
14:58:36 <savetheWorld> %IANAL Not tested, possibly invalid syntax, expression of an Idea only, YMMV, IANAL, YANAL etc.. yada yada, details left as an exercise for the reader to finalize.  have you called your mom lately?  ^_^
14:59:04 <savetheWorld> DoomSkull: rm $( ls -1 | grep -v "*sh*" )
14:59:16 <greycat> savetheWorld: NO!!!
14:59:24 <greycat> DoomSkull: DO NOT listen to savetheWorld
14:59:38 <savetheWorld> greycat: how would you do it?
14:59:43 <greycat> !extglob > savetheWorld
14:59:43 ->#bash savetheWorld: "Extended globs" (shopt -s extglob) allow you to say things like "all files that do not end in .jpg". See http://wooledge.org/mywiki/glob
15:00:12 <savetheWorld> bah. Does mine work or not?
15:00:23 <greycat> savetheWorld: it does NOT.  It has major whitespace issues.
15:00:37 <savetheWorld> no it doesnt
15:00:42 <greycat> savetheWorld: touch "a file name"
15:00:52 <savetheWorld> ok, ys it does
15:01:27 <savetheWorld> i never run into those because i dont allow filenames with spaces in them. :-D
15:01:35 <prince_jammys> trolling?
15:01:45 <savetheWorld> prince_jammys: who?
15:01:54 <prince_jammys> oh, noone
15:02:15 <savetheWorld> prince_jammys: no. not trolling. its a frequent issue
15:02:36 <savetheWorld> prince_jammys: and truly, I dont allow file names with shitespace in them on my systems
15:02:42 <prince_jammys> rm $( ls -l ) in this channel .... come on
15:02:58 <savetheWorld> prince_jammys: its an abortion imported from Windows
15:03:22 <prince_jammys> abortion as in abort, retry, fail?
15:03:23 <_eggy_> nothing wrong with whitespace in files, it makes you write proper commands for handling them.
15:03:37 <greycat> prince_jammys: even worse, "ls -1 | ..." is just moronic.
15:03:44 <greycat> the -1 is implicit when stdout of ls is not a tty
15:03:55 <savetheWorld> prince_jammys: every channel has idiosyncracies, that doesnt make the idiosyncrasy the truth,   Its just another part of the body of knowledge.
15:04:03 <greycat> savetheWorld: you are a fool.
15:04:20 <greycat> We aren't talking about "idiosyncracies".  We're talking about commands that do not work.
15:04:37 <savetheWorld> greycat: heh, They work here. :-)
15:05:47 <pgas> you just have to hope someone does try "touch '*'" in your directory
15:05:56 <pgas> doesn't try
15:07:04 <savetheWorld> greycat: perhaps if you were less of a nasty obnoxious <-------> you would have more success with getting your messages across.  Flaming people to a burnt cinder before giving them a good explanation or a better way does not exactly create an environment conducive to receptivity.  Besides, I already acknowledged it doesnt work with spaces above.  so whats your real motivation for being abusive?
15:08:02 <greycat> 14:57  DoomSkull> anyone know how to rm all files in a directory except a particular pattern
15:08:05 <greycat> 14:57  greycat> !extglob > DoomSkull
15:08:08 <greycat> 14:57  greybot> DoomSkull: "Extended globs" (shopt -s extglob) ....
15:08:11 <greycat> 14:58  savetheWorld> rm $( ls -1 | grep -v "*sh*" )
15:08:32 <savetheWorld> greycat: perhaps if you reversed the order and gave a good clear explanation first  and then dropped the abuse completely people would get more out of it.
15:08:47 <greycat> I did.  Your shitty, dangerous answer followed my answer.
15:08:52 <prince_jammys> but you know why ....
15:09:02 <savetheWorld> greycat: I'm talking about the way you treated me.
15:09:12 <greycat> You have been a regular in this channel for months, if not years.  You should KNOW better than to do something like that.
15:09:40 <savetheWorld> I know you never miss a chance to be nasty.
15:10:04 <greycat> No, what is NASTY is telling newbie to use commands that could remove the wrong files.
15:10:17 <savetheWorld> which counts a great deal more to me than your technical prowess. bye
15:10:28 <savetheWorld> plonk

16. Marchitos vs bash tests

<Marchitos> if i want to check if a variable has 1 or 0 how can i do?
<Marchitos> if [ $find == 1 ] ; then balblabla
<Marchitos> is it correct?
<kbrandt> Marchitos: Has or Is?
<Marchitos> is
<kbrandt> For is, then if [[ "$find" == '1' ]]; then
<kbrandt> Good habit to double quote variables
<Marchitos> $find can contain a number
<Marchitos> like 0 or 9
<Marchitos> if i want to check which number is i have to do: if [ "$find" == '1' ] ; then balblablal ?
<kbrandt> Marchitos: Well if there are bunch of numbers and you want to do different actions depends on which number then you want to use the 'case' construct
<Marchitos> only two case
<Marchitos> an if is good
<Marchitos> but it don't want to work
<Marchitos> maybe i'm using a wrong syntax
<kbrandt> Marchitos: Maybe:-) Why don't you ask it what it really wants to do? ;-)
<Marchitos> mmm
<Chapoolin> Marchitos:} use "[[ ]]", instead of "[ ]" . . . it was made to overcome problems with "[ ]"
<Chapoolin> hyphenated:} why?
<Marchitos> don't work
<Marchitos> if [[ "$find" == '0' ]] ; then
<Marchitos> is it right?
<Chapoolin> Marchitos:} no
<Marchitos> if [[ "$find" = '0' ]] ; then
<prince_jammys> (( find == 0 )) or (( ! find ))
<prince_jammys> !tests
<greybot> In bash, use [[ .. ]] to perform tests on strings and files. Use (( .. )) to evaluate arithmetic expressions. Only use [ .. ] when you are writing an *sh* script, *not* a bash script!
<Chapoolin> Marchitos:} "==" checks for text string.  To check for arithmetic value, use "-eq"
<Marchitos> if (( "$find" == '0' )) ; then
<prince_jammys> if (( find == 0 )); then
<prince_jammys> no dollar in (( )) is better
<prince_jammys> makes no difference, UNLESS find isn't set. then you get errors with $
<Marchitos> if (( find -eq 0 )) ; then
<prince_jammys> for fucks sake
<prince_jammys> (( find == 0 ))
<Marchitos> don't work
<Chapoolin> Marchitos:} try this: "if [[ $find -eq 0 ]] ; then"
<Marchitos> no
<Marchitos> http://pastebin.com/m309daaa1
<kbrandt> prince_jammys: What about trying to devide the variable by 0 ;-)
<prince_jammys> might as well
<Marchitos> can we do this?  find=`expr $find + 1`
<prince_jammys> (( find++ ))
<Chapoolin> Marchitos:} try this: "if [[ $find -eq 0 ]] ; then"
<Marchitos> a moment..
<Marchitos> if [ "$find" -eq 1 ] ; then
<Marchitos> works :D

17. illsci vs. greycat

16:17 + illsci [n=illsci@recoil.defensiblenetworks.com] joined #openssh
16:17  illsci|#openssh> hey has anyone ever seen a script or system that lets users connect and generate their ssh key's and enforces passphrase complexity?
16:18  greycat> "connect and generate the keys"??
16:18  illsci> if you had a ton of users you wanted to generate new keys for and wanted it all done on the same physical server, wanted to enforce passphrase complexity,
16:18  greycat> key generation is done on the client system, not on the server.  a private key should ideally NEVER leave the machine on which it was generated.
16:18  illsci> thats fine.. pretend its not going anywhere
16:19  illsci> but you dont want to trust users to pick good passphrases
16:19  illsci> is there any systems that manage that... .wrappers to ssh-keygen or something
16:19  greycat> Since you have no control over the client system, and you have no control over the humans using it, and no knowledge whatsoever of whether there even IS a passphrase on the private key stored on the client system, I'm not sure what you want us to tell you.
16:19  illsci> just wondering if anyone uses or has seen anything like that scripted
16:19  illsci> well i guess you're not reading what i said
16:20  greycat> I have no idea what you're talking about.
16:20  illsci> im asking for a way to make sure there is a passphrase
16:20  illsci> and to make sure its a good one
16:20  illsci> ie. not a for apple
16:20  greycat> Are you on the server or on the client?
16:20  illsci> a linux server capable of generating keys
16:20  greycat> I give up.
16:20  illsci> that's where the users are
16:20  greycat> you're unhelpable.
16:21  illsci|#openssh> jesus christ
16:21  illsci|#openssh> what difference does it make if its  a server or a client
16:21  illsci|#openssh> they could have walke dup to a console and had to type it in
16:22  illsci> i just want to make sure in an automated way the passphrase is good
16:22  illsci> and i dont want to knwo what it is
16:22  illsci> how is that so hard to understand
16:22  greycat> Because the private key is on the client system, not on the server system.  If you're on the server you're not involved in the generation of the keypair AT ALL.
16:22  greycat> The generation is done by the user.  On the client.
16:22  illsci> i understand hwo public key auth works
16:22  illsci> do you understand how key generation works?
16:22  greycat> You have no control over that process.
16:22  illsci> you get a public and private key on the same system
16:23  illsci> nevermind
16:23  illsci> you're a retard
16:23 - illsci [n=illsci@recoil.defensiblenetworks.com] left #openssh ()

18. xeon-enouf vs. greycat

<xeon-enouf> ok, so how can i use sed to remove all the '$' that start each line, or even just remove the blank line itself?
<xeon-enouf> bah
<greycat> ##sed
<xeon-enouf> ok, so how can i use sed to remove all the '$' that END each line, or even just remove the blank line itself?
<xeon-enouf> figures
* xeon-enouf sucks
<greycat> dare I ask why you have literal dollar signs at the end of "each line"?
<bronze> -e 's/\$$//'  <== maybe?
<xeon-enouf> i don't; but after my attempts, i also now have a ^M
<greycat> !cr
->#bash Carriage Return (ASCII 13). Often written as ^M or \r. CRs are found just before newlines in text files generated by DOS/Windows apps. You can see them with "cat -e". See http://mywiki.wooledge.org/BashFAQ/052 to get rid of them.
<xeon-enouf> i know what ^M is
<greycat> you can't have $ at the end of each line and ALSO have a blank line in the file.
<xeon-enouf> listen man, i don't want to argue with you; i'm in a fighting mood - just let it go ... i cannot explain it, except to say, bugs find me and 1000 variations of the same script yield nothing but reboots
<greycat> If you can't explain the problem, then we can't solve it.
<xeon-enouf> indeed - i concur
<greycat> "HOW TO DELETE $ AT THE END OF EVERY LINE"   sed 's/\$$//'
<xeon-enouf> sorry for wasting anyone's time
<greycat> "HOW TO REMOVE ALL BLANK LINES"   sed '/^$/d'
<xeon-enouf> now you can go fuck yourself
<greycat> They are two very different operations.
<xeon-enouf> and suck my left testicle

19. harrumph vs. greycat

15:16:34 <harrumph> if i wanted to whois x.x.x.x >> foo and I wanted x.x.x.x as first line of new input, how?
15:16:40 <greycat> harrumph: { echo x.x.x.x; whois x.x.x.x; } >> foo
15:16:57 <harrumph> greycat: duh, thanks
...
15:22:10 <harrumph> greycat: harrumph: { echo x.x.x.x; whois x.x.x.x; } >> foo fails with syntax error near unexpected token `}'    sorry don 't see why
15:22:30 <greycat> harrumph: you fucked it up somehow, probably by omitting space
15:25:14 <harrumph> greycat: ?  No whois server is known for this kind of object.
15:25:24 <greycat> !exact > harrumph
15:25:24 ->#bash harrumph: Please tell us EXACTLY what you typed, and EXACTLY what the error is.
...
15:25:56 <blardydragon> greycat: i would, but the scenario is a bit difficult to explain without a simple example (imo)
15:26:08 <tuxdev> !nopaste
15:26:08 ->#bash Please don't waste our time by making us go to a pastebin just for a five-line snippet. Paste it in the channel. If you have a larger script that's showing problems, trim it down to the bare minimum size that still shows the problem. You'll probably fix it yourself once you do that.
15:26:21 <blardydragon> ok i will try and explain
15:26:33 <harrumph> ok no pastebin then
15:26:53 <harrumph> { echo x.x.x.x; whois x.x.x.x; } >> /var/log/ foo
15:26:57 <harrumph> tail foo
15:27:09 <greycat> harrumph: you have space between the directory name and the filename
15:27:10 <lhunath> is that space there deliberately?
15:27:10 <harrumph> No whois server is known for this kind of object.
15:27:29 <greycat> also, you are trying to do a lookup of a domain named x.x.x.x which is clearly and utterly stupid
15:27:30 <lhunath> if 'whois' is erroring; take it up with man whois
15:28:02 <harrumph> sorry no, i hand-replaced the filename
15:28:24 <greycat> harrumph: never type code into IRC.  Paste the code.
15:28:48 <greycat> arc1:~$ whois x.x.x.x
15:28:49 <greycat> No whois server is known for this kind of object.
15:29:03 <harrumph> lol: so listen to greycat not greybot - please don't waste our time by making us go to a pastebin
15:29:25 <harrumph> greycat: oh, sorry
15:29:26 <greycat> harrumph: why are you trying to "whois" x.x.x.x?
15:29:59 <harrumph> greycat: i want to store the results in a file when i see something weird in /var.log/messages
15:30:19 <greycat> harrumph: WHY.  ARE.  YOU.  PASSING.  THE.  LITERAL.  STRING.  x.x.x.x  TO.  THE.  WHOIS.  COMMAND?
15:30:35 <greycat> Why are you not passing some sort of valid DOMAIN NAME?
15:30:41 <harrumph> greycat: i was told to by someone here.  why are you yelling?
15:30:42 <lhunath> harrumph: whois would be happier with digits instead of x'es
15:30:52 <greycat> I'm yelling because you're a fucking idiot!
15:30:58 <greycat> *plonk*
15:31:00 <drake1> greycat: that's for whois to decide
15:31:12 <greycat> drake1: and it told him.  and he didn't like the answer.
15:31:32 * greycat goes to extract and enshrine this one.

20. greycat vs. maiceuv

14:27 + maiceuv [~i@117-40.76-83.cust.bluewin.ch] joined #bash
14:28  maiceuv> private\
14:31  maiceuv> :& _=$!; sleep .7& wait&& K $_ # workaji
14:34  maiceuv> azzaa
14:35  maiceuv> hai
14:44  maiceuv> 7 7 -7 +7 ' 7' \
14:44  maiceuv> owwnnnn\
14:57  maiceuv> stockholm
14:57  maiceuv> u want compl for remove names ?
14:57  maiceuv>  use s[s]hfs
14:59  maiceuv> try what i siad
14:59  maiceuv> or go pwn and get ownt
14:59  stockholm> maiceuv: what does "pwn" mean?
15:25  stockholm> maiceuv: ?
15:48  maiceuv> wt6kxi: ai do jec da tic cukcszzi beveu
15:49  maiceuv> d l=nlo i=rnlong wet=ya6
15:49  maiceuv> wt6kxi: ai do jec da tic cukcszzi beveu
15:49  maiceuv> \
16:01  maiceuv> d 
runway=okclrnlong[own,copy,cuectem=lab,r=dore,$nlo,ng=newgeneration,=+[*+],=thes
tandard],w(sch)=e[td]u[ul]er,language=$nlo nlo=nolossoptimize nolossoptimize=$( 
                < ~/runway.nlo) %xir \ic\ inglisch \!\ %nearlydone%don..e
16:02  maiceuv> lab kot
16:04  maiceuv> u \neab \what \so \on \kot \eh \?\
16:05  maiceuv> alsoissayings
16:05  maiceuv> allthisiswrittenasspokenbeforemybynauceyv
16:05  maiceuv> iown
16:05  maiceuv> \
16:05  maiceuv> good
16:05 ~ ChanServ set +o greycat on #bash
16:05  maiceuv> tellme:audio:char=tovibrate
16:05  maiceuv> stfu greycat
16:05 @greycat> maiceuv: Stop.
16:05  maiceuv> u die greycat
16:05  maiceuv> die
16:05  maiceuv> if u ban me
16:05  maiceuv> otherwise
16:05  maiceuv> lab
16:05  maiceuv> like
16:05  maiceuv> live
16:05 ~ greycat set +b *!*@117-40.76-83.cust.bluewin.ch on #bash
16:06 ! maiceuv was kicked from #bash by greycat (maiceuv)
16:06  unpaidbill> hilarious.
16:06 ~ greycat set -o greycat on #bash
16:06 <-maiceuv[~i@117-40.76-83.cust.bluewin.ch] u die
16:06 <-maiceuv[~i@117-40.76-83.cust.bluewin.ch] get the dead fucking and its k
16:06 <-maiceuv[~i@117-40.76-83.cust.bluewin.ch] and tell me once u unban me
16:06 <-maiceuv[~i@117-40.76-83.cust.bluewin.ch] while u dont
16:06 <-maiceuv[~i@117-40.76-83.cust.bluewin.ch] u die all the time
16:07 <-maiceuv[~i@117-40.76-83.cust.bluewin.ch] ill fix this once i find to do 
          it . = depending on how you act
16:07 <-maiceuv[~i@117-40.76-83.cust.bluewin.ch] so:
16:07 <-maiceuv[~i@117-40.76-83.cust.bluewin.ch] die
16:07 <-maiceuv[~i@117-40.76-83.cust.bluewin.ch] !
16:07  TheBonsai> greycat has a weird fanbase..
16:07 <-maiceuv[~i@117-40.76-83.cust.bluewin.ch] \
16:07 <-maiceuv[~i@117-40.76-83.cust.bluewin.ch] ownt j00\
16:07 <-maiceuv[~i@117-40.76-83.cust.bluewin.ch] \
16:07 ->[maiceuv] msgBetter get a better doctor and a new prescription.  Your 
          meds aren't working properly.
16:08  greycat> I'm sure you recognized him even though he has changed his nick 
                yet again.
16:09  RanyAlbeg> greycat: I think he mastered bash now.
16:09 <-maiceuv[~i@117-40.76-83.cust.bluewin.ch] stfuu noob
16:09 <-maiceuv[~i@117-40.76-83.cust.bluewin.ch] if u tell such bs again u die
16:09 <-maiceuv[~i@117-40.76-83.cust.bluewin.ch] die
16:09 <-maiceuv[~i@117-40.76-83.cust.bluewin.ch] noobass
16:09 <-maiceuv[~i@117-40.76-83.cust.bluewin.ch] stfu
16:09 <-maiceuv[~i@117-40.76-83.cust.bluewin.ch] itellu
16:09 <-maiceuv[~i@117-40.76-83.cust.bluewin.ch] imtheteacher
16:10 <-maiceuv[~i@117-40.76-83.cust.bluewin.ch] andteachersaysgreycatshalldie
16:10 <-maiceuv[~i@117-40.76-83.cust.bluewin.ch] diegreycatdie
16:10 <-maiceuv[~i@117-40.76-83.cust.bluewin.ch] tereowntgreycat
16:10 <-maiceuv[~i@117-40.76-83.cust.bluewin.ch] sounbanmaiceuvgreyschitt
16:10 <-maiceuv[~i@117-40.76-83.cust.bluewin.ch] die
16:10 <-maiceuv[~i@117-40.76-83.cust.bluewin.ch] because
16:10 <-maiceuv[~i@117-40.76-83.cust.bluewin.ch] udidnotdothatgreatso
16:10 <-maiceuv[~i@117-40.76-83.cust.bluewin.ch] 
          bigafatuglyassfuckerwithshitfucksinyourshittaggevissaggeshit
16:10  greycat> He's oh so hilarious in /msg too.

21. greycat vs. wart___

11:12  wart___> hi folks.  hopefully someone can help me with something i 
                probably should know (and I'm fine with getting schooled on 
                this): i'd like to write a simple wrapper script called 
                dmenu.sh which wraps a program called dmenu.  Now dmenu allows 
                for input from both args (e.g., dmenu -p "foo" -l 5) and also 
                pipe, e.g., echo "foo bar" | dmenu -p "foo" -l 5.
11:12  greycat> if (($# == 0)); then read -r; set -- "$REPLY"; fi   # ?
11:12  wart___> I can have the wrapper script (dmenu.sh) do something like: 
                dmenu ${1+"@"} to get at the arguments.  But I forget how to 
                get at the piped input.
11:13  greycat> read.
11:13  pgas> wart___: do nothing, you get it for free
11:14  wart___> pgas: well the script actually does three things: svkbd; dmenu 
                ${1+"@"}; killall svkbd
11:14  wart___> so i wasn't sure if i get it for free or not.
11:14  greycat> oh, his wrapper doesn't need to CARE?  I thought it did for 
                some reason.
11:14  greycat> Stupid me, assuming the user's question actually makes any 
                sense.
11:15  wart___> greycat: was that "read" directed at me?

22. darknop vs. greycat

<darknop> ok, a bash related security question: is it safe to check for the existence of "$HOME"/.no_XYz in, say, /etc/profile and if "$HOME"/.no_XYZ exists and is empty, then do not do something predefined by the system administrator?
<darknop> what if that file was a hard link to some device file that hangs when you try to read from it or determine its size, or even stat() it?
<darknop> s/hangs/causes a hang/
<e36freak> would uh, have to be a bit more specific than that
<e36freak> what leads you to believe it wouldn't be "safe" ?
<pgas> darknop: hardlinks are the real thing there is no difference between a hard link and a "normal" file
<greycat> every normal file is a hardlinnk
<darknop> e36freak: some file being read that just hangs the shell after the shell starts to read it
<darknop> isn't that possible?
<darknop> I know fifos can do things like that, but not without them being actually read
<darknop> if you just stat() them to figure out their size or that they are in fact fifos, there is no problem.
<greycat> darknop: stat(2) should be safe as long as users cannot mount file systems in their $HOME
<darknop> greycat: they can, but only fuse filesystems, and then they have to be a member of the fuse group, and users can mount wherever they want if they have root access.
<greycat> darknop: if the users have root access, it doesn't matter.  If they break something, it's their own damned fault.
<greycat> They could just hack out your /etc/profile check, or whatever.
<darknop> greycat: only I have root access
<greycat> You JUST SAID "... and users can mount wherever they want if they have root access."
<greycat> THIS IMPLIES THAT SOME OF THEM HAVE ROOT ACCESS.
<greycat> Otherwise, why the hell did you write it?
<darknop> some of them means at least one of them
<greycat> What the fuck is WRONG with you?
<darknop> not two or more
<darknop> greycat: what is wrong with you?
<greycat> May I offer a bit of advice?  Coming into a discussion channel and asking *trick questions* designed to mislead the people who are sacrificing their own spare time to help you is not going to earn you much assistance.
<darknop> greycat: I never meant to ask a trick question. If you think that my question was a trick question, that is your own problem.
<greycat> *plonk*

23. AntelopeSalad vs. greycat and greybot and Riviera and geirha

09:49  AntelopeSalad> how can i get a variable that is set with a heredoc to correctly interpolate new lines with sh? http://pastebin.com/MS7Mb60c
09:49  pasteban> or http://sprunge.us/PDHb (AntelopeSalad: use https://gist.github.com/ next time, #bash hates animated ads)
09:50  greycat> what do you mean, "variable set with a heredoc"?  Just write a multi-line assignment.
09:50  AntelopeSalad> with that gist example it strips the newlines
09:50  greycat> foo="blah blah $bar
09:50  greycat> blah blh $applesauce"
09:50  AntelopeSalad> greycat, did you look at the gist?
09:50  Riviera> AntelopeSalad: It should only strip trailing ones?
09:50  greycat> NO!
09:50  pgas> AntelopeSalad: echo "$foo" with the quotes
09:50  greycat> AND I DO NOT PLAN TO!
09:50  geirha> !wordsplitting
09:50  greybot> echo $foo; rm $foo -- If you leave $foo unquoted, bash will *remove* all whitespace (newlines, spaces, tabs) while expanding it, take each *word* as a separate argument. `echo` prints these words separated by one space and `rm` deletes each word. So ALWAYS *quote* your parameter expansions: echo "$foo"
09:50  greycat> pgas: that was my second guess.
09:50  AntelopeSalad> Riviera, it removes all of them
09:50  greycat> !pf echo
09:50  greybot> http://mywiki.wooledge.org/BashPitfalls#pf14 -- Don't do this! -- echo $foo
09:50  Riviera> AntelopeSalad: only if you expand your variable without quotes.
09:51  greycat> !qefs
09:51  greybot> "$Quote" "$Every" "$Fucking" "$Substitution"
09:51  AntelopeSalad> Riviera, so what is the solution?
09:51  Riviera> AntelopeSalad: (everything greybot and greycat said were for you)
09:51  AntelopeSalad> i'm redirecting the variable to a file
09:51  greycat> QUOTE IT
09:51  AntelopeSalad> and it outputs the file as 1 line
09:51  Riviera> AntelopeSalad: quote it.
09:51  geirha> """""""""""""""""""""""""  <-- there you go, have some
09:52  AntelopeSalad> quoting it doesn't work
09:52  Riviera> AntelopeSalad: ah come on, show how you do it.
09:52  AntelopeSalad> it's still output as 1 line
09:52  greycat> imadev:~$ foo="blah blah one line
09:52  greycat> > blah blah another line"
09:52  greycat> imadev:~$ echo "$foo"
09:52  greycat> blah blah one line
09:52  greycat> blah blah another line
09:52  AntelopeSalad> http://pastebin.com/ihm2Dc3K
09:52  pasteban> or http://sprunge.us/BWAj (AntelopeSalad: use https://gist.github.com/ next time, #bash hates animated ads)
09:53  Riviera> AntelopeSalad: You said the variable's content goes to a file.
09:53  greycat> YOU DID NOT SHOW THE ****EXPANSION**** OF $foo
09:53  Riviera> AntelopeSalad: Show how you do *that*.
09:53  greycat> DO NOT QUOTE THE ASSIGNMENT
09:53  greycat> QUOTE THE FUCKING SUBSTITUTION
09:53  dualbus> :)
09:53  greycat> echo "$foo"
09:53  greycat> NEVER echo $foo
09:54  greycat> !pf echo > AntelopeSalad 
09:54  greybot> AntelopeSalad: http://mywiki.wooledge.org/BashPitfalls#pf14 -- Don't do this! -- echo $foo
09:54  greycat> !pf echo > AntelopeSalad 
09:54  greybot> AntelopeSalad: http://mywiki.wooledge.org/BashPitfalls#pf14 -- Don't do this! -- echo $foo
09:54  greycat> !pf echo > AntelopeSalad 
09:54  greybot> AntelopeSalad: http://mywiki.wooledge.org/BashPitfalls#pf14 -- Don't do this! -- echo $foo
09:54  AntelopeSalad> thanks Riviera
09:54  Riviera> hehe
09:54  AntelopeSalad> it works now, i also put that retard on ignore
09:54  Riviera> wtf 8)
09:54  greycat> Oh fuck, he has a dynamic IP... well of COURSE he does.  All idiots do.
09:55  greycat> It is how they survive.  They can't be perma-ignored.
09:55  Riviera> greycat: I apologise in the name of everything sound and sane. 8)
09:55  greycat> Well, I can perma-ignore him by nickname and hope he has a static nickname.

24. rixon vs. greycat and osse

11:00:37 <rixon> Hi. I'm having a little trouble with .bashrc - how does it get executed on login? when I connect via ssh, my ~/.bashrc doesn't get loaded... but it does if I then just execute bash
11:01:03 <greycat> login shells read .bash_profile which *SHOULD* source .bashrc (possibly after double-checking that it exists)
11:02:19 <rixon> is that supposed to be in ~/ or somewhere else?
11:02:35 <greycat> !dotfiles
11:02:35 ->#bash Set up your environment (PATH, LANG, EDITOR, ...) in ~/.bash_profile. Set up your bash shell (PS1, functions, shopts, ...) in ~/.bashrc. Then source .bashrc from .bash_profile. See <http://mywiki.wooledge.org/DotFiles>. For GUI logins, SEE YOUR DOCUMENTATION or ask your OS channel because they're all different and we don't know.
11:04:10 <rixon> I don't have a .bash_profile or a .profile in ~/
11:04:16 <rixon> is it supposed to be in ~/?
11:04:35 <sjohnson> rixon: what command are you using to see if they exist?
11:04:35 <greycat> Create one.
11:04:40 <rixon> ls -a ~
11:04:58 <osse> Bash may do some trickery when used over ssh, but AFAIK that trickery should make sourcing bashrc more "likely", for lack of a better word
11:05:24 <greycat> Oh yes, that.
11:05:38 <greycat> But anyway, if you want login stuff, make a .bash_profile
11:05:52 <greycat> Make sure it includes [[ -f ~/.bashrc ]] && source ~/.bashrc
11:05:55 <rixon> if I don't have a .profile or a .bash_profile, I can't be sure that something is even trying to execute it - what calls them?
11:06:03 <greycat> JUST FUCKING MAKE IT ALREADY
11:06:12 <greycat> God DAMN.
11:06:19 <rixon> whoah
11:06:22 <rixon> calm down lol
11:06:30 <rixon> it's not hard to answer my question is it?
11:06:39 <greycat> 11:04  greycat> Create one.
11:06:42 <greycat> 11:05  greycat> But anyway, if you want login stuff, make a .bash_profile
11:06:46 <rixon> that's not an answert to my question
11:06:50 <greycat> *plonk*
11:07:09 <osse> I didn't understand your question. The last one.
11:07:42 <rixon> my question was: 'what calls them?' (.profile or .bash_profile)
11:07:53 <rixon> calls can be read as executes
11:08:00 <rixon> it's nto that hard to understand is it?
11:08:03 <rixon> pfff
11:08:08 <osse> If they don't exist then nothing
11:08:17 <rixon> and if they do?
11:08:19 <rixon> ffff
11:08:20 <rixon> jeez
11:08:22 <osse> bash
11:08:33 <rixon> so there's no /etc/.profile or something?
11:08:48 <rixon> it's just 'bash does it'
11:08:49 <osse> There could be
11:08:50 <rixon> ha
11:09:12 <rixon> well I'll remember not to come in here again fuckin ell

25. SgrA vs. greycat

10:30:04 <SgrA> I have some files: file30, file31, ..., file70. I need to pass them to a program inside quotes, like ./myprog -i "file30 file31 ... file70". How can I save the effort of typing the entire thing out?
10:30:21 <greycat> How do you know the files have no spaces in their names?
10:30:52 <greycat> Also, did you actually *write* myprog?  Is it really yours?  If so, you can fix it.  Make it not have to do this.
10:32:21 <SgrA> greycat: The file names won't have spaces because they are generated by another program that I wrote.
10:32:39 <greycat> turn on extglob, hit enter.  a=(file!(* *)) IFS=$' \t\n' tmp="${a[*]}"; ./myprog -i "$tmp"
10:33:04 <greycat> That way it'll at least skip the filenames that have spaces.
10:35:26 <SgrA> I need something simpler, and really don't need to worry about spaces.
10:35:48 <Maskettaman> why not use a loop
10:35:56 <SgrA> Maybe I could have something to expand it like this: ./myprog -i file30 -i file31 -i file32 ... -i file70 ?
10:36:16 <Maskettaman> does it need to stop at file 70
10:36:23 <Maskettaman> or just iterate from 1 till end
10:36:24 <SgrA> Yes
10:36:28 <greycat> ./myprog -i file1 file2 file3 ... -- -j -q -z
10:36:37 <greycat> or maybe -- isn't the best delimiter here
10:36:56 <djph> for files in ./file* ; do ./myprog $files ; done .. YAY!
10:37:09 <greycat> The more traditional answer is "if the -i option is supplied, it must be LAST"
10:37:23 <djph> granted, not knowing what 'myprog' does, that probably won't work
10:37:23 <greycat> that way you can just do ./myprog -j -q -z -i file*
10:38:25 <SgrA> I'm using getopt in myprog to process. It doesn't like spaces in between so if I just use -i file*, it'll end up taking only the first one.
10:38:35 <SgrA> djph: I need all the files to be simultaneously loaded in the program.
10:38:41 <greycat> getopt is FUCKING EVIL
10:38:43 <greycat> NEVER USE getopt
10:38:44 <greycat> EVER
10:38:47 <greycat> EVER EVER EVER
10:39:28 <SgrA> Um, why?
10:39:41 <djph> getopt is FUCKING EVIL
10:39:56 <djph> maybe
10:39:56 <greycat> Now, if you actually meant getopts, which is not evil, and which can sometimes be used, then your problem is that you are still violating the implicit Unix rules for option processing, so getopts cannot handle this case.  You have to write your own option processor.
10:40:37 <SgrA> grep getopt *.c | wc
10:40:44 <SgrA>    10    69    593
10:40:46 <password2> is evil sexy atleast/
10:40:48 <greycat> Here is why getopt is EVIL:
10:40:48 <greycat> imadev:~$ getopt nullarg '' 'arg with spaces'
10:40:48 <greycat> --  arg with spaces
10:41:06 <password2> :/
10:41:14 <greycat> The empty argument is completely fucking OBLITERATED, and the argument with internal spaces is blown to hell.
10:41:16 <SgrA> I'm using getopt in my C code
10:41:23 <SgrA> Is it different or same?
10:41:30 <greycat> ask ##c
10:41:48 <greycat> !faq options
10:41:48 ->#bash http://mywiki.wooledge.org/BashFAQ/035 -- How can I handle command-line options and arguments in my script easily?
10:41:52 <SgrA> Well myprog is written in C and I'm using getopt there, and it seems to work fine.
10:42:07 <greycat> You have a nonstandard option paradigm, so you will need to write your own loop.
10:42:40 <greycat> Decide whether you want a sentinel after -i files*, or to have the -i option appear last, or to have -i file1 -i file2 ...
10:42:58 <greycat> ... you aren't fucking in basdh
10:43:08 <greycat> YOU AREN'T FUCKING WRITING BASH
10:43:09 <greycat> AND YOU ARE HERE
10:43:25 <greycat> Can I reach through the internet and kill him?  Please?
10:43:30 <djph> greycat: yes
10:43:35 <SgrA> Well I wanted to figure out how to get bash to expand the way I suggested.
10:43:46 <SgrA> One could treat myprog as a blackbox. It has nothing to do with C.
10:43:54 ~ SgrA kicked from #bash by greycat (Offtopic. Go to ##c)
(he rejoined)
10:44:14 <SgrA> I'm sorry if that was offensive. But seriously?
10:44:15 <SgrA> Hi
10:44:23 <greycat> You are OFF TOPIC
10:44:56 <SgrA> All I wanted was to see if bash can do it for me without having to change my code.
10:45:15 <greycat> 10:32  greycat> turn on extglob, hit enter.  a=(file!(* *)) IFS=$' \t\n' tmp="${a[*]}"; ./myprog -i "$tmp"
10:45:16 <SgrA> My myprog is irrelevant, it could be written in rust for all we care.
10:47:15 <SgrA> Thanks to the kick I can't copy paste, but I had then written something along the lines of "Is it possible to make it simpler? I'm sure the filenames won't have spaces."
(he was banned by hostmask)
10:47:39 ~ SgrA kicked from #bash by greycat (SgrA)
10:48:07 <greycat> !flw
10:48:07 ->#bash Famous last words: "The filenames will never have spaces." "There won't ever be a newline inside the <a> tag." "There will only be one } at the end of the config file."
10:48:40 <greycat> I need more.  The "filenames will never have spaces" one is so lonely.
10:49:31 <Maskettaman> I go make a nice ginseng tea
10:49:34 <Maskettaman> and this happens
10:49:35 <Maskettaman> top kek
10:52:39 <Maskettaman> also greycat, not to be harshing, and he should have just explained myprog, but isnt writing (and asking help about) scripts that pipe stuff into binaries sorta a big part of working in the shell?
10:52:47 <Maskettaman> he was completely rude about it, thats no doubt
10:53:02 <greycat> He was given direct answers.  He was given design alternatives.
10:53:05 <greycat> He was WARNED.
10:53:53 <Maskettaman> yeah going on was a stupid move
10:54:23 <greycat> I don't know what you mean by "piping stuff into binaries".  He was asking how to pass arguments from bash to a C program with a uselessly broken option usage, and I showed how to do it.  Twice.

(he changed hostmask and tried to rejoin)
11:11:15 ~ SgrA kicked from #bash by candide (Evaded *!*@gateway/web/freenode/ip.219.91.152.89 set by greycat)

(he changed hostmask again, and also nick)
11:23:42 <SgrC> ./myprog -i `echo file{30..70} | tr " " ","`
11:23:46 <SgrC> This is how it's supposed to be done.
11:24:08 <SgrC> And honestly, that ban was ridiculous.
11:24:12 <SgrC> I'm going.
(he was banned under his third hostmask)
11:24:44 <greycat> The good news is, his "solution" is wrong.
11:25:00 <greycat> I am glad he will continue not to have a working invocation.
11:25:01 <colo-work> isn't there a way for bash to expand brace expansions with some in-between character other than " "?
11:25:11 <greycat> I was maybe gonna revoke the ban at noon, but ... not now.
11:25:30 <greycat> colo-work: it's not a space.  It's a separate WORD.
11:25:43 <colo-work> hm, wasn't aware of that
11:25:50 <greycat> A brace expansion generates a list of strings.  Separate arguments.  Not a single string with spaces in it.
11:25:52 <DrkShad0w> the first character of IFS
11:26:01 <greycat> DrkShad0w: no, that's "$*"
11:26:13 <greycat> Which is what I used in the solution that I gave the asshat.
11:26:31 <colo-work> I'm afraid my scrollback doesn't have that info :\
11:26:48 <colo-work> could you please show me, greycat?
11:27:01 <greycat> imadev:~$ args a{1..3}
11:27:02 <greycat> 3 args: <a1> <a2> <a3>

11:38:14 <celyr> greycat, he never went to ##C :P

26. charking

17:03  charking> if [[ -n "$1" ]]; then sequence="$1"; else read -r sequence;
                 fi  <-- Is there a simpler way than this to handle either $1
                 or STDIN in a Bash function?
17:05  twkm> what do you find is not simple about it charking?
17:05  charking> twkm: That it's an if/else.  I thought there might be a single 
                 command.
17:06  charking> I guess I don't need the -r
17:08  greycat> !read-r
17:08  greybot> Always use read with the -r option, otherwise backslashes are 
                special. 
http://wiki.bash-hackers.org/commands/builtin/read#read_without_-r

27. hussar

13:04  hussar> what's the difference between () and $()
13:05  greycat> () is a subshell (fork).  $() is a command substitution.
13:05  greycat> !guide
13:05  greybot> http://mywiki.wooledge.org/BashGuide or in PDF: 
                http://s.ntnu.no/bashguide.pdf
13:08  hussar> why bother having this channel if the answer to questions is to 
               go read a bash manual and figure it out urself
13:08  twkm> it isn't.
13:08  greycat> I answered the question and then gave a link to further 
                information.  This is FUNDAMENTAL basic stuff that you should 
                be reading on your own.
13:08  greycat> We are not here to read basic beginner tutorial information to 
                you.
13:09  hussar> I am and i was confused, that's why i came here
13:09  greycat> So ask another question.
13:09  twkm> so you got an answer.  you don't seem to like it.
13:09  hussar> i'm trying to learn the basics, that detail was confusing, so i 
               asked here. that should be allowed
13:09  twkm> it is.  go read the guide, it explains the difference.
13:10  hussar> just was a little annoyed by the link
13:10  greycat> *plonk*

28. sruli

11:14  sruli> how can i generate combination of all items in an array? "arr=(1, 
              2, 3)" i need an output of "1". "1,2". "1,2,3". "2,1" etc
11:15  greycat> !homework
11:15  greybot> "I have to count the lines in a file. But I'm not allowed to 
                use wc. And I'm not allowed to use grep. And I have to type it 
                in using a teletype. With no paper in it. In the dark. 
                Left-handed."
11:16  phy1729> Do you need all combinations or all permutations?
11:17  greycat> the sample output was pretty clear
11:17  greycat> however, that array definition is wrong.  do not use commas.
11:18  sruli> the sample showed combinations, but i really only need 
              permutations
11:18  greycat> *sigh*
11:18  greycat> are you FUCKING KIDDING ME
11:19  phy1729> permutations is harder
11:19  greycat> you can't produce a correct array definition, and your sample 
                output is WRONG
11:19  sruli> sorry, i need combinations, not permutations
11:19  greycat> *plonk*

Libera Chat

1. thebombzen

11:50:21 <thebombzen> another question I'm wondering is the difference between .profile and .bash_profile
11:50:36 <greycat> !dotfiles
11:50:36 <greybot> Set up your environment (PATH, LANG, EDITOR, ...) in ~/.bash_profile. Set up your bash
                   shell (PS1, functions, shopts, ...) in ~/.bashrc. Then source .bashrc from .bash_profile.
                   See <http://mywiki.wooledge.org/DotFiles>. For GUI logins, SEE YOUR DOCUMENTATION or ask
                   your OS channel because they're all different and we don't know.
11:50:45 <thebombzen> let me actually ask my question please
11:50:53 <greycat> if .bash_profile exists, .profile won't be used, except by other shells of course
11:51:02 <thebombzen> let me actually ask my question please

You did ask a question. You're not the only person in the channel asking questions at any given moment. Don't spread your question across multiple "lines". Ask the question all at once, without lead-in commentary. If you can't fit the whole question into a single IRC "line", then perhaps IRC is not the best medium for your question. See NetEtiquette and Bash FAQ 64.

If that were the extent of it, it wouldn't be worth posting here. But it continued.

11:50:53 <greycat> if .bash_profile exists, .profile won't be used, except by other shells of course
11:51:02 <thebombzen> let me actually ask my question please
11:51:17 <greycat> You stopped typing.  So a question was asked, and then we answered it.
11:51:44 <autopsy> (noise)
11:51:55 <autopsy> (noise)
11:52:07 <thebombzen> I'm aware that bash ignores .profile if .bash_profile is found, but what's standard practice
                      to reconcile this difference on a system where someone has multiple login shells
11:52:35 <autopsy> (noise)
11:52:52 <lopid> source .profile from .bash_profile?
11:52:52 <thebombzen> I'm considering putting all shell-agnotsic code in .profile and then, inside .bash_profile,
                      add a line [ -f ~/.profile ] && . ~/.profile
11:52:54 <greycat> It's not "reconciliation".  It's a tool that lets you set up different profiles for different
                   shells, in case you switch between them, or in case your HOME is shared by NFS across systems
                   with different shells, etc.
11:52:57 <autopsy> (noise)
11:53:17 <jmd> thebombzen: How can a user have multiple login shells. Only one can be listed in /etc/passwd?
11:53:28 <greycat> Imagine you have two computers.
11:53:37 <neshpion> rich people
11:53:48 <autopsy> (several lines of noise)
11:55:01 <neshpion> but just because those are interactive shells doesn't make them your login shell
11:55:16 <autopsy> (noise)
11:55:27 <thebombzen> greycat: right, what I mean is, if there's code that I want to share between those scenarios
                      is there a common idiom that people do with this
11:55:27 <autopsy> (noise)
11:55:43 <greycat> If you only have one computer (on this network), and if you don't switch shells frequently, then
                   just pick one file and stick with it.

All good so far, right? Wait for it. Here it comes....

11:55:58 <autopsy> (noise)
11:56:03 <thebombzen> I sometimes switch to zsh to test something
11:56:14 <autopsy> (noise)
11:56:15 <thebombzen> and all my crap borked in that case cause I just used .bash_profile
11:56:21 <greycat> Congratulations, you're a special snowflake.  Now decide how you want to handle that.
11:56:31 <autopsy> (noise)
11:56:51 <thebombzen> okay greycat who shit in your cerial
11:56:59 * lopid (noise)
11:57:11 <autopsy> (noise)
11:57:19 * neshpion (noise)
11:57:21 <thebombzen> if I ask if there's a common idiom to handle a specific scenario and you can just say
                      "no, use what works"
11:57:23 <autopsy> (noise)
11:57:27 <thebombzen> why are you always such an ass
11:57:37 <thebombzen> like every time
11:57:53 <greycat> You did not MENTION a specific scenario until just now.

What's the real issue here? The issue is that this user felt entitled to help, because they're the Star of the Show. Nobody is allowed to say anything mean to the Star. Everybody is expected to guess exactly what unusual setup the Star is using, without being told. The Star is allowed to demand individual attention. The rules don't apply to the Star.

I was completely and utterly polite to this person right up until their big surprise reveal. This includes earlier questions which I answered for them, not shown here. But if I say just one slightly mean thing to the Star of the Show, suddenly I'm the villain.

Sigh.

Idiot (last edited 2021-11-05 15:08:05 by emanuele6)