LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   bash script gone wild (https://www.linuxquestions.org/questions/linux-newbie-8/bash-script-gone-wild-124547/)

ipconfig 12-10-2003 08:31 AM

bash script gone wild
 
I wrote a small bash script randomjoke that downloads a random joke from bash.org:
Code:

[root@calcium ~]# cat /bin/randomjoke
#! /bin/bash

cat ~/.randomjoke

(lynx --dump bash.org/?random | sed -n -e '/\[12\]/,/\[16\]/p' | grep -v '\[1[26]\]' > ~/.randomjoke &) >& /dev/null

This all works fine when using it from the prompt.
Code:

[root@calcium ~]# cat ~/.randomjoke

  <linux> "So... my girlfriend told me she thought i was a pedophile the
  other day."
  <linux> "so i says to her, that's an awfully big word coming from a 12
  year old."
  <DGF> LOL

[root@calcium ~]#
[root@calcium ~]# (lynx --dump bash.org/?random | sed -n -e '/\[12\]/,/\[16\]/p' | grep -v '\[1[26]\]' > ~/.randomjoke &) >& /dev/null

But when I try /bin/randomjoke it hangs for a long while, then gives me a whole lot of error messages:
Code:

[root@calcium ~]# /bin/randomjoke
/bin/bash: error while loading shared libraries: libtermcap.so.2: cannot open shared object file: Error 23
/bin/bash: /usr/bin/id: Too many open files in system
/bin/bash: /usr/bin/id: Too many open files in system
/bin/bash: /usr/bin/id: Too many open files in system
/bin/bash: [: too many arguments
/bin/bash: /usr/bin/tput: Too many open files in system
/bin/bash: pipe error: Too many open files in system
/bin/bash: [: : integer expression expected
/bin/bash: /usr/bin/dircolors: Too many open files in system
/bin/bash: /bin/grep: Too many open files in system

  Anonymous: Ramadan is over, i can eat!!!
  Anonymous2: I was surfing the internet and i found a page that said
  more women go for guys that are/were in the Air Force then any other
  profession.
  Anonymous: Really, I wanna join the air force one day.
  Anonymous2: Wat, so u could learn how to fly planes into skyscrapers.
  Anonymous: Fool, you're muslim too.
  Anonymous: You r a disgrace to brown pple.
  Anonymous2: Don't be silly i'm not brown, i'm just a really tanned
  white person.

id: error while loading shared libraries: libc.so.6: cannot open shared object file: Error 23
id: error while loading shared libraries: libc.so.6: cannot open shared object file: Error 23
id: error while loading shared libraries: libc.so.6: cannot open shared object file: Error 23
/bin/bash: [: too many arguments
/bin/bash: cannot make pipes for command substitution: Too many open files in system
/bin/bash: cannot make pipes for command substitution: Too many open files in system
/bin/bash: [: : integer expression expected
/bin/randomjoke: /bin/randomjoke: Too many open files in system
id: cannot find name for group ID 0
id: cannot find name for user ID 0
unknown terminal "xterm"
/bin/bash: /usr/bin/tput: Too many open files in system
wc: error while loading shared libraries: libc.so.6: cannot open shared object file: Error 23
/bin/bash: [: : integer expression expected
dircolors: `/etc/DIR_COLORS': Too many open files in system
cut: error while loading shared libraries: libc.so.6: cannot open shared object file: Error 23
cut: error while loading shared libraries: libc.so.6: cannot open shared object file: Error 23
cat: /root/.randomjoke: Too many open files in system
/bin/bash: cannot make pipes for command substitution: Too many open files in system
/bin/bash: cannot make pipes for command substitution: Too many open files in system
/bin/bash: cannot make pipes for command substitution: Too many open files in system
/bin/bash: [: too many arguments
/bin/bash: cannot make pipes for command substitution: Too many open files in system
/bin/bash: cannot make pipes for command substitution: Too many open files in system
/bin/bash: [: : integer expression expected
/bin/bash: cannot make pipes for command substitution: Too many open files in system
/bin/bash: pipe error: Too many open files in system
cat: /root/.randomjoke: Too many open files in system
/bin/bash: /bin/cut: Too many open files in system
/bin/bash: /bin/cut: Too many open files in system
cat: error while loading shared libraries: libc.so.6: cannot open shared object file: Error 23
/bin/bash: cannot make pipes for command substitution: Too many open files in system
/bin/bash: cannot make pipes for command substitution: Too many open files in system
/bin/bash: cannot make pipes for command substitution: Too many open files in system
/bin/bash: [: too many arguments
/bin/bash: cannot make pipes for command substitution: Too many open files in system
/bin/bash: cannot make pipes for command substitution: Too many open files in system
/bin/bash: [: : integer expression expected
/bin/bash: cannot make pipes for command substitution: Too many open files in system
/bin/bash: pipe error: Too many open files in system
id: cannot find name for group ID 0
id: cannot find name for user ID 0
dircolors: `/etc/DIR_COLORS': Too many open files in system
cat: /root/.randomjoke: Too many open files in system
id: error while loading shared libraries: libc.so.6: cannot open shared object file: Error 23
id: error while loading shared libraries: libc.so.6: cannot open shared object file: Error 23
id: error while loading shared libraries: libc.so.6: cannot open shared object file: Error 23
/bin/bash: [: too many arguments
tput: error while loading shared libraries: libncurses.so.5: cannot open shared object file: Error 23
/bin/bash: /usr/bin/tput: Too many open files in system
wc: error while loading shared libraries: libc.so.6: cannot open shared object file: Error 23
/bin/bash: [: : integer expression expected
dircolors: error while loading shared libraries: libc.so.6: cannot open shared object file: Error 23
grep: error while loading shared libraries: libc.so.6: cannot open shared object file: Error 23
/sbin/consoletype: error while loading shared libraries: libc.so.6: cannot open shared object file: Error 23
id: cannot find name for group ID 0
id: cannot find name for user ID 0
cat: /root/.randomjoke: Too many open files in system
id: cannot find name for group ID 0
id: cannot find name for user ID 0
dircolors: `/etc/DIR_COLORS': Too many open files in system
cat: /root/.randomjoke: Too many open files in system
id: cannot find name for group ID 0
id: cannot find name for user ID 0
dircolors: `/etc/DIR_COLORS': Too many open files in system
cat: /root/.randomjoke: Too many open files in system
cat: /root/.randomjoke: Too many open files in system
id: cannot find name for group ID 0
id: cannot find name for user ID 0
dircolors: `/etc/DIR_COLORS': Too many open files in system
cat: /root/.randomjoke: Too many open files in system
id: cannot find name for group ID 0
id: cannot find name for user ID 0
id: cannot find name for group ID 0
id: cannot find name for user ID 0
dircolors: `/etc/DIR_COLORS': Too many open files in system
cat: /root/.randomjoke: Too many open files in system
id: cannot find name for group ID 0
id: cannot find name for user ID 0
tput: error while loading shared libraries: libncurses.so.5: cannot open shared object file: Error 23
dircolors: `/etc/DIR_COLORS': Too many open files in system
cat: /root/.randomjoke: Too many open files in system
cut: error while loading shared libraries: libc.so.6: cannot open shared object file: Error 23
cut: error while loading shared libraries: libc.so.6: cannot open shared object file: Error 23
cut: error while loading shared libraries: libc.so.6: cannot open shared object file: Error 23
cat: /root/.randomjoke: Too many open files in system
/bin/bash: cannot make pipes for command substitution: Too many open files in system
/bin/bash: cannot make pipes for command substitution: Too many open files in system
/bin/bash: cannot make pipes for command substitution: Too many open files in system
/bin/bash: [: too many arguments
/bin/bash: cannot make pipes for command substitution: Too many open files in system
/bin/bash: cannot make pipes for command substitution: Too many open files in system
/bin/bash: [: : integer expression expected
/bin/bash: cannot make pipes for command substitution: Too many open files in system
/bin/bash: pipe error: Too many open files in system
id: cannot find name for group ID 0
id: cannot find name for user ID 0
id: cannot find name for group ID 0
id: cannot find name for user ID 0
dircolors: `/etc/DIR_COLORS': Too many open files in system
cat: /root/.randomjoke: Too many open files in system
id: cannot find name for group ID 0
id: cannot find name for user ID 0
tput: error while loading shared libraries: libc.so.6: cannot open shared object file: Error 23
dircolors: `/etc/DIR_COLORS': Too many open files in system
id: cannot find name for group ID 0
id: cannot find name for user ID 0
id: cannot find name for group ID 0
id: cannot find name for user ID 0
dircolors: `/etc/DIR_COLORS': Too many open files in system

[root@calcium ~]#

What could be the cause of such a thing?

Tinkster 12-10-2003 12:18 PM

Re: bash script gone wild
 
Quote:

Originally posted by ipconfig
I wrote a small bash script randomjoke that downloads a random joke from bash.org:
Code:

[root@calcium ~]# cat /bin/randomjoke
#! /bin/bash

cat ~/.randomjoke

(lynx --dump bash.org/?random | sed -n -e '/\[12\]/,/\[16\]/p' | grep -v '\[1[26]\]' > ~/.randomjoke &) >& /dev/null


No idea, works here ;)


Cheers,
Tink

ipconfig 12-10-2003 02:53 PM

Never mind, I guess.
I did all that coding from work via VNC...
I got home and now it works.
Superodd, isn't it?


All times are GMT -5. The time now is 11:59 AM.