LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
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!

Notices


Reply
  Search this Thread
Old 08-02-2020, 10:58 AM   #1
Kintaro
LQ Newbie
 
Registered: Aug 2020
Distribution: Mint 19.2
Posts: 14

Rep: Reputation: Disabled
cant fix: "CLEAR: command not found" when trying to execute in terminal. "CLEAR" is part of code not the command to wipe the terminal screen


Hey guys,

Im currently going through a bash-script tutorial.

Unfortunately its from a magazine, so its difficult to show you the exact tutorial.

However a line in the code say i=0; CLEAR; CIVIS;NULL=/dev/null

and when I try to execute the file I get the notion "CLEAR: command not found".

I checked for typos or anything, but I cant find any. Also Im not sure, where to find the correct syntax for the clear-command. Web searches simply show problems with the terminal command.

The code example also is something above my actual horizon and the tutorial also says so Id still like to know, what went wrong there.

I hope I could make my problem "clear" .

Thanks in advance.

K
 
Old 08-02-2020, 12:03 PM   #2
mrmazda
Senior Member
 
Registered: Aug 2016
Location: USA
Distribution: openSUSE 24/7; Debian, Knoppix, Mageia, Fedora, others
Posts: 3,834
Blog Entries: 1

Rep: Reputation: 1279Reputation: 1279Reputation: 1279Reputation: 1279Reputation: 1279Reputation: 1279Reputation: 1279Reputation: 1279Reputation: 1279
Linux is case sensitive. CLEAR is not the same command as clear. CAPS are typically used for variables, rarely for commands.
 
1 members found this post helpful.
Old 08-02-2020, 01:44 PM   #3
Kintaro
LQ Newbie
 
Registered: Aug 2020
Distribution: Mint 19.2
Posts: 14

Original Poster
Rep: Reputation: Disabled
Nice, thank you ! In the tutorial it is in all caps but I tried it without and it worked.

After debugging a few other line I came to the following

while [[ "$0" |= " " ]];do case $i in

and in the terminal it says
line 47: unexpected token `|', conditional binary operator expected␌⎺└└▒┼␍ ┼⎺├ ⎺┤┼␍
./bashselection.sh: line 47: syntax error near `|='
./bashselection.sh: line 47: ` while [[ "$0" |= " " ]];do case $i in'

Problem is: The part where I wrote "|=" is written so small in the magazine, that I cant recognize, which symbol it shows.
Is there maybe a common one that would fit here?
 
Old 08-02-2020, 01:51 PM   #4
mrmazda
Senior Member
 
Registered: Aug 2016
Location: USA
Distribution: openSUSE 24/7; Debian, Knoppix, Mageia, Fedora, others
Posts: 3,834
Blog Entries: 1

Rep: Reputation: 1279Reputation: 1279Reputation: 1279Reputation: 1279Reputation: 1279Reputation: 1279Reputation: 1279Reputation: 1279Reputation: 1279
Post #3 shows many non-alphanumeric characters (mostly high-ASCII box-drawing and "|") here that make it impossible to understand whatever your are trying to script.
 
1 members found this post helpful.
Old 08-02-2020, 01:59 PM   #5
MadeInGermany
Senior Member
 
Registered: Dec 2011
Location: Simplicity
Posts: 1,888

Rep: Reputation: 836Reputation: 836Reputation: 836Reputation: 836Reputation: 836Reputation: 836Reputation: 836
The correct operator is != (not equal)
 
1 members found this post helpful.
Old 08-02-2020, 02:04 PM   #6
Kintaro
LQ Newbie
 
Registered: Aug 2020
Distribution: Mint 19.2
Posts: 14

Original Poster
Rep: Reputation: Disabled
The code example is for an graphical bash selection menu.
Like I said, its way above my skills and I dont really understand the code, but now that I started to copy it, I want to make it work.
In the lines I marked with >>> on the left, each red"|" is a symbol I cant recognize, because it is printed so small



REFRESH(){ after=$((i+1)); before=$((i-1))
if [[ $before -lt 0 ]];then before=$LM;fi
if [[ $after -gt $LM ]];then after=0;fi
if [[ $j -lt $i ]];then UNMARK;M$before;else UNMARK;M$after;fi
>>> if [[ $after -eq 0 ]] || [ $before -ew $LM ];then
UNMARK; M$before; M$after;fi;j=$i;UNMARK;M$before;M$after;}
INIT(){ R;HEAD;FOOT;MENU;}
SC(){ REFRESH;MARK;$S;$b;cur='ARROW' ;}
ES(){ MARK;$e "ENTER = main menu ";$b;read;INIT;};INIT
>>> while [[ "$0" |= " " ]];do case $i in
0) S=M0;SC;if [[ $cur == "" ]];then R;$e "\n$(w )\n";ES;fi;;
1) S=M1;SC;if [[ $cur == "" ]];then R;$e "\n$(ifconfig )\n";ES;fi;;
2) S=M1;SC;if [[ $cur == "" ]];then R;$e "\n$(df -h )\n";ES;fi;;
3) S=M1;SC;if [[ $cur == "" ]];then R;$e "\n$(route -n )\n";ES;fi;;
4) S=M1;SC;if [[ $cur == "" ]];then R;$e "\n$(date )\n";ES;fi;;
5) S=M1;SC;if [[ $cur == "" ]];then R;$e "\n$($e by oto )\n";ES;fi;;
6) S=M1;SC;if [[ $cur == "" ]];then R;exit 0;fi;;
esac;POS;done
 
Old 08-02-2020, 03:03 PM   #7
Kintaro
LQ Newbie
 
Registered: Aug 2020
Distribution: Mint 19.2
Posts: 14

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by MadeInGermany View Post
The correct operator is != (not equal)
thanks, I had that before the "=" at first but changed it because of the other line. Could you think of the right symbol, where I wrote "||"?
Simply putting in "!!" results in:

./bashselection.sh: line 42: syntax error near unexpected token `!!'
./bashselection.sh: line 42: ` if [[ $after -eq 0 ]] !! [ $before -ew $LM ];then'
 
Old 08-02-2020, 03:28 PM   #8
MadeInGermany
Senior Member
 
Registered: Dec 2011
Location: Simplicity
Posts: 1,888

Rep: Reputation: 836Reputation: 836Reputation: 836Reputation: 836Reputation: 836Reputation: 836Reputation: 836
The || (double pipe, logical OR) is correct.
But there is no -ew operator; perhaps it should be -eq (equal, comparing numbers).
 
1 members found this post helpful.
Old 08-02-2020, 05:08 PM   #9
Kintaro
LQ Newbie
 
Registered: Aug 2020
Distribution: Mint 19.2
Posts: 14

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by MadeInGermany View Post
The || (double pipe, logical OR) is correct.
But there is no -ew operator; perhaps it should be -eq (equal, comparing numbers).
that makes the print even worse, but at least now I got it. I didn't even notice the "ew"-mistake. Thank you both very much
I really wouldn't have figured it out without you.
 
Old 08-02-2020, 06:27 PM   #10
KGIII
Member
 
Registered: Sep 2015
Location: North-Western, Maine - in the mountains.
Distribution: Lubuntu 18.04 LTS
Posts: 158
Blog Entries: 6

Rep: Reputation: 64
Typing in code found in magazines?

That brings back some memories.

The code not running, ambiguous, poor font choices, or just plain wrong?

That brings back some memories.

Glad they got you sorted out, but man this thread bring back some old memories.
 
Old 08-03-2020, 04:12 PM   #11
MadeInGermany
Senior Member
 
Registered: Dec 2011
Location: Simplicity
Posts: 1,888

Rep: Reputation: 836Reputation: 836Reputation: 836Reputation: 836Reputation: 836Reputation: 836Reputation: 836
Quote:
That brings back some memories.
Early 80th, Commodore, Sinclair?
 
Old 08-03-2020, 04:55 PM   #12
ondoho
LQ Addict
 
Registered: Dec 2013
Posts: 18,434
Blog Entries: 12

Rep: Reputation: 5627Reputation: 5627Reputation: 5627Reputation: 5627Reputation: 5627Reputation: 5627Reputation: 5627Reputation: 5627Reputation: 5627Reputation: 5627Reputation: 5627
Quote:
Originally Posted by Kintaro View Post
In the tutorial it is in all caps
Then either the tutorial is very, very bad, or it's not a bash tutorial. Maybe it's a batch scripting tutorial (or similar) which I believe is a DOS/Windows thing?

In any case, there's no point pursuing this on a bash shell.

There's plenty of good bash tutorials out there.
 
Old 08-03-2020, 05:27 PM   #13
KGIII
Member
 
Registered: Sep 2015
Location: North-Western, Maine - in the mountains.
Distribution: Lubuntu 18.04 LTS
Posts: 158
Blog Entries: 6

Rep: Reputation: 64
Quote:
Originally Posted by MadeInGermany View Post
Early 80th, Commodore, Sinclair?
Among others, like Byte.
 
  


Reply


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
[SOLVED] No package 'x11' found No package 'xext' found No package 'xdamage' found No package 'xfixes' found No package 'x11-xcb' found Jigsaw Linux From Scratch 14 02-23-2021 09:35 PM
New install Xubuntu 14.04 trying to replace default terminal with Terminator error:Failed to execute default Terminal Emulator bdalzell Ubuntu 2 06-19-2016 05:40 AM
[SOLVED] complete noob question. "command not found" "command not found" jeanlucpicard Linux - Newbie 4 08-27-2013 03:14 AM
how do i replace the clear "clear screen" with the cls command thefedexguy SUSE / openSUSE 2 12-02-2005 06:02 PM
syslog dump/clear/erase/de-bloat/wipe NewKreation Linux - Newbie 1 03-12-2004 07:33 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 12:07 PM.

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