LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 04-29-2017, 05:21 AM   #1
stamcose
Member
 
Registered: Nov 2009
Posts: 56

Rep: Reputation: 15
BASH in new SUSE 42.2, command EXPR does not work?


The command "expr" does not seem to work at all with the BASH included in release 42.2! Error message:

"No child process".

What is wrong?
 
Old 04-29-2017, 05:28 AM   #2
stamcose
Member
 
Registered: Nov 2009
Posts: 56

Original Poster
Rep: Reputation: 15
The attachment was missing!
Attached Thumbnails
Click image for larger version

Name:	expr.png
Views:	30
Size:	15.5 KB
ID:	24882  
 
Old 04-29-2017, 05:57 AM   #3
Jjanel
Member
 
Registered: Jun 2016
Distribution: any&all, in VBox; Ol'UnixCLI; NO GUI resources
Posts: 999
Blog Entries: 12

Rep: Reputation: 363Reputation: 363Reputation: 363Reputation: 363
Did you notice it is using YOUR ~/bin/expr? What is 'that'? cd /home/mats/bin; ls -l expr; file expr; ... (maybe cat it!)
Try \expr 1 + 1 (backslash to force 'system' expr)
 
1 members found this post helpful.
Old 04-29-2017, 06:06 AM   #4
ondoho
LQ Addict
 
Registered: Dec 2013
Posts: 17,250
Blog Entries: 10

Rep: Reputation: 5160Reputation: 5160Reputation: 5160Reputation: 5160Reputation: 5160Reputation: 5160Reputation: 5160Reputation: 5160Reputation: 5160Reputation: 5160Reputation: 5160
...additionally, expr is not part of bash, it's part of coreutils.
but bash can do integer arithmetics all by itself:
Code:
echo $((1 + 1))
 
Old 04-29-2017, 06:09 AM   #5
Habitual
LQ Veteran
 
Registered: Jan 2011
Location: Abingdon, VA
Distribution: Catalina
Posts: 9,374
Blog Entries: 37

Rep: Reputation: Disabled
Code:
which expr
 
Old 04-29-2017, 07:17 AM   #6
stamcose
Member
 
Registered: Nov 2009
Posts: 56

Original Poster
Rep: Reputation: 15
Sorry, my mistake! By mistake there was an "expr" in /home/mats/bin that was taken instead of the real "expr". This "expr" was in fact the simple test:

a=`expr 1 + 1`
echo $a

Because of the name-collisition it was then calling itself! I have no idea how this test got into this directory with this name!

I did not think of this possibility! But I really should like Jjanel have noted "/home/mats/bin" in the prompt!

Issue solved!
 
Old 04-29-2017, 08:12 AM   #7
BW-userx
LQ Guru
 
Registered: Sep 2013
Location: Somewhere in my head.
Distribution: Slackware (current), FreeBSD, Win10, It varies
Posts: 9,952

Rep: Reputation: 2148Reputation: 2148Reputation: 2148Reputation: 2148Reputation: 2148Reputation: 2148Reputation: 2148Reputation: 2148Reputation: 2148Reputation: 2148Reputation: 2148
yeah if that is some expr exe in that dir /.../.../.../expr then it'd be dot forword slash command ./expr 1 + 1 BUT if you got an expr already installed in /usr/bin then you should not be having this issue becsuse it'd already just work because /usr/bin should be in your PATH - echo $PATH to see

Code:
userx%slackwhere ⚡ ~ ⚡> ls /usr/bin/expr
/usr/bin/expr
BASH - VERSION
Quote:
userx%slackwhere ⚡ ~ ⚡> echo $BASH_VERSION
echo $BASH_VERSION
4.3.46(1)-release
expr
Code:
userx%slackwhere ⚡ ~ ⚡> expr 1 + 5
6

Last edited by BW-userx; 04-29-2017 at 08:19 AM.
 
Old 04-29-2017, 08:30 AM   #8
BW-userx
LQ Guru
 
Registered: Sep 2013
Location: Somewhere in my head.
Distribution: Slackware (current), FreeBSD, Win10, It varies
Posts: 9,952

Rep: Reputation: 2148Reputation: 2148Reputation: 2148Reputation: 2148Reputation: 2148Reputation: 2148Reputation: 2148Reputation: 2148Reputation: 2148Reputation: 2148Reputation: 2148
Quote:
Originally Posted by stamcose View Post
The attachment was missing!
just a little "just so you know" on this one. you can click edit -> advance -> then add the image then save within the same post.
 
Old 04-29-2017, 03:31 PM   #9
ondoho
LQ Addict
 
Registered: Dec 2013
Posts: 17,250
Blog Entries: 10

Rep: Reputation: 5160Reputation: 5160Reputation: 5160Reputation: 5160Reputation: 5160Reputation: 5160Reputation: 5160Reputation: 5160Reputation: 5160Reputation: 5160Reputation: 5160
...also a simple copy-paste of text is infinitely preferable to a screenshot, which is a complte waste of bandwidth in this situation.
 
  


Reply

Tags
bash


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
Why does this work from the bash command line and then fails in a bash script? Rupadhya Linux - Newbie 5 09-26-2012 12:05 AM
how are ksh Integer and expr translated into Bash? zhegoofy Linux - Newbie 2 02-24-2012 04:46 AM
Using expr command to read values from two different files delineator Programming 1 03-21-2011 02:24 AM
How to multiply with expr? ( expr 3 * 4 doesn't work, though expr 3 + 4 does) lumix Linux - General 5 02-25-2009 05:31 PM
Usage of 'expr' command subu_s Programming 2 12-03-2004 01:23 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 05:40 AM.

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