LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 06-11-2013, 01:31 PM   #1
DarioGi
LQ Newbie
 
Registered: Apr 2013
Posts: 8

Rep: Reputation: Disabled
Shell command: not found


I'm running a script which is triggered by the kernel object of device attachment. The purpose of the script is to run one of the commands that are loaded with the device and grep a certain line which prints the firmware version. When I lookat the log I get the following errors: "command": not found. My issue here is that when I run this script manually, everything seems to work, and that "command" is found and works properly. I also included 60 seconds wait time so that this module/drivers would be loaded by that time (just in case), which seems not to help since the script is executed after drivers are loaded anyways. Any help would be appreciated, thanks!
 
Old 06-11-2013, 03:46 PM   #2
rtmistler
Moderator
 
Registered: Mar 2011
Location: USA
Distribution: MINT Debian, Angstrom, SUSE, Ubuntu, Debian
Posts: 9,882
Blog Entries: 13

Rep: Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930
It depends on the script. The script is triggered not by your shell which has your path and environment information, but other path and environment information. Echo out the environment information to a debug log file when the script runs.

Code:
env > my-log.log
Check that against what you have in your user environment.

You also need to get to the bottom of what command is not being found. Do you get a line number? Or is the script one line only? Either case, find out what command is being rejected.

A final point is that for most scripts I include the full pathname for all executable commands.

Instead of "ls" I use "/bin/ls" because ls is located in the /bin directory. If you're unsure, when in your shell, perform
Quote:
which <command>
to get the path for the command you're running from within the script and then place that path into the script file.
 
Old 06-11-2013, 04:01 PM   #3
schneidz
LQ Guru
 
Registered: May 2005
Location: boston, usa
Distribution: fedora-35
Posts: 5,313

Rep: Reputation: 918Reputation: 918Reputation: 918Reputation: 918Reputation: 918Reputation: 918Reputation: 918Reputation: 918
to help debug try issueing an echo $PATH from within your script and compare it with the output of the your $PATH variable. try using the /path/to/program from within the script to ensure it can find the command.
 
Old 06-12-2013, 02:45 AM   #4
NevemTeve
Senior Member
 
Registered: Oct 2011
Location: Budapest
Distribution: Debian/GNU/Linux, AIX
Posts: 4,862
Blog Entries: 1

Rep: Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869
You are being too secretive... Loading kernel-modules / attaching hardware doesn't add new commands to the shell or installs new executable binaries, so please try to explain what are you actually talking about.
 
Old 06-12-2013, 06:58 AM   #5
konsolebox
Senior Member
 
Registered: Oct 2005
Distribution: Gentoo, Slackware, LFS
Posts: 2,248
Blog Entries: 8

Rep: Reputation: 235Reputation: 235Reputation: 235
Interesting. Are you running Android? I'm just starting to learn more of it so please add more details.
 
Old 06-12-2013, 08:07 PM   #6
ta0kira
Senior Member
 
Registered: Sep 2004
Distribution: FreeBSD 9.1, Kubuntu 12.10
Posts: 3,078

Rep: Reputation: Disabled
Are you using a udev rule?

Kevin Barry
 
  


Reply



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] shell problem, command not found Alex92 Linux - Newbie 2 05-04-2012 12:42 PM
running shell script: command not found tripat Red Hat 3 04-14-2010 01:21 PM
Shell Scripting Problem: command not found gods_design Programming 3 02-10-2009 11:58 PM
Command not found error - difference in shell? aw_wolfe Linux - Newbie 6 04-20-2005 04:49 PM
command not found (My shell script) Swift&Smart Linux - Software 3 05-15-2004 11:14 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 03:58 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