Download your favorite Linux distribution at LQ ISO.
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!


  Search this Thread
Old 12-16-2015, 03:51 AM   #16
LQ Newbie
Registered: Apr 2015
Posts: 24

Original Poster
Rep: Reputation: Disabled

stop with the cussing and the getting angry. just go bother another thread. did you have questions here, or are you just here to troll? just go away.

edit: you can't make the script work. you're pasting from manpages with no idea what the actual problem is. you came here in the first place to start a flamewar and troll. just GO. AWAY. you're not answering my question or helping me understand anything. your only intention is to try and belittle me while offering nothing constructive. just don't reply again. find something else to occupy your time.

Last edited by like100ninjas; 12-16-2015 at 03:57 AM. Reason: had to underline the go away part
Old 12-16-2015, 02:23 PM   #17
Registered: Oct 2014
Location: Cyberinternetspace
Distribution: Slackware, mostly
Posts: 49

Rep: Reputation: 2
Calm down, sparky. First off, those aren't manpages. Those lines of output are from help read, which are not man pages. man pages are man pages.

Secondly: What? You came to the internet and expected someone to just fix a poorly written, uncommented, broken desktop rice script for you?

Finally: I'm teaching you something critical to the practice of programming, if you would pull your head from your behind long enough to learn it.
Old 12-17-2015, 04:35 PM   #18
Senior Member
Registered: Jul 2012
Location: Aachen, Germany
Distribution: Void, Debian
Posts: 1,013

Rep: Reputation: 305Reputation: 305Reputation: 305Reputation: 305
Let's get back to topic.

In your while condition you are doing this:
$( read -r line )
Now, look at the following tests:
$ read -r line
bla bla
$ echo $line
bla bla
$ foobar=$( read -r line_2 )
bla blubb
$ echo $foobar

$ echo $line_2

So, as you correctly suggested, the read command happens in a subshell, and the assigned value of the line variable will never become available in your script.
On top of that, the read command does not write anything to stdout, so the $() returns an empty string. Hence, the length of the string (-n test) will never be non-zero, and your condition will never be true.

What you need to do is e.g. this:

read -r line
while [[ -n $line ]] {
    echo "You typed: "$line
    # do stuff
    read -r line

(I am sure it can be done in a more elegant way, but you get the point)
Old 12-18-2015, 09:17 AM   #19
LQ Guru
Registered: Sep 2013
Location: Somewhere in my head.
Distribution: FreeBSD/Slackware-14.2+/ArcoLinux
Posts: 9,146

Rep: Reputation: 1947Reputation: 1947Reputation: 1947Reputation: 1947Reputation: 1947Reputation: 1947Reputation: 1947Reputation: 1947Reputation: 1947Reputation: 1947Reputation: 1947
Originally Posted by like100ninjas View Post
edit: once again, trying to make this lemonbar script work. i fixed all the error messages, and the script runs. i think my problem might be that i'm testing `read -r line' in a subshell, so the script never really parses the lines i'm trying to read. just a hunch. anyone know how to fix this? or maybe something else is wrong.

edit again: i keep trying different things but no text shows up on the bar still. i've tried adding "print $line" underneath the while line and nothing shows up.

off of another place on netland -> and lemonBar -> example

# Define the clock
Clock() {
        DATE=$(date "+a b %d, %T")

        echo -n "$DATE"

# Print the clock

while true; do
        echo "%{c}%{Fyellow}%{Bblue} $(Clock)%{F-}"
        sleep 1;
Pont is: it is using BASH too

I use i3Status (bar) myself

though that seems rather simple, have you tried typing it all out right, if it is the error that states it is near } -- usally means you might have something within that file that is tossing an error, as I seen no missing quote marks in the code.

you could try a fresh sheet of Epaper and write it out again or just saveAs over top of it, the same file, as well. to clean it up and seee if it might have been something within the file itself.

ot try a different info bar -- or just format and install fresh OS (just playing)

zsh, don't know but most likely it is a typo error missing something one of them really stupid formatting errors like a quote or a space missing or is there that is not suppose to be

Last edited by BW-userx; 12-18-2015 at 09:29 AM.


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
LXer: Shell Scripting Part 3: Decision Control Structures in Shell Scripts LXer Syndicated Linux News 0 05-05-2015 10:01 PM
LXer: Shell Scripting Part 2: Accepting Inputs and Performing Shell Arithmetic LXer Syndicated Linux News 0 04-30-2015 07:10 AM
LXer: Shell Scripting Part I: Getting started with bash scripting LXer Syndicated Linux News 0 04-29-2015 08:03 AM
win32,shell code,shell programming,shell scripting? mr.cracker Linux - Newbie 4 07-12-2013 11:20 PM
teaching shell scripting: cool scripting examples? fax8 Linux - General 1 04-20-2006 04:29 AM > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 01:15 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration