LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
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-06-2010, 06:56 AM   #1
Super TWiT
Member
 
Registered: Oct 2009
Location: Cyberville
Distribution: Debian
Posts: 132

Rep: Reputation: 16
Command Not Found??


When I try to execute this:
Code:
magic=0x1234 j=0 for i in `sed -e '1,2d' /media/disk/Other/Network\ Card/original-rom | cut -c 9- | tr -d "\n"` do echo ethtool -E eth0 magic $magic offset 0x$(printf %x ${j}) value 0x${i} j=$(($j + 1)) done
I get a command not found error. It's an ethtool script I found online. I am using it to reprogram my ethernet controller as it is having corrupt firmware issues. I have ethtool installed, so I am not sure what the problem is. It's probably something simple.---
 
Old 06-06-2010, 07:03 AM   #2
colucix
LQ Guru
 
Registered: Sep 2003
Location: Bologna
Distribution: CentOS 6.5 OpenSuSE 12.3
Posts: 10,509

Rep: Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983
The ethtool executable is usually installed in /sbin (which is not in user's PATH) since it is an administrative tool. I don't think it works as a normal user, hence you have to acquire root's privileges to run this command. If it is not installed in the standard place for some reasons, you can invoke it by specifying the full absolute path. Hope this helps.
 
Old 06-06-2010, 07:07 AM   #3
Super TWiT
Member
 
Registered: Oct 2009
Location: Cyberville
Distribution: Debian
Posts: 132

Original Poster
Rep: Reputation: 16
Oh, should have mentioned that I tried executing it as root too.
 
Old 06-06-2010, 07:27 AM   #4
colucix
LQ Guru
 
Registered: Sep 2003
Location: Bologna
Distribution: CentOS 6.5 OpenSuSE 12.3
Posts: 10,509

Rep: Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983
Sorry, I was just too focused on ethtool you did mention in the question and I didn't notice that you missed some command separator in your line. First, we cannot define a variable in that way before a for loop (only before commands) but we have to put the assignment on its own line. Second an inline for loop must have semi-colon before the do and done keywords. Something like this should do the trick:
Code:
magic=0x1234 ; j=0 ; for i in `sed -e '1,2d' /media/disk/Other/Network\ Card/original-rom | cut -c 9- | tr -d "\n"` ; do echo ethtool -E eth0 magic $magic offset 0x$(printf %x ${j}) value 0x${i} j=$(($j + 1)) ; done
 
Old 06-06-2010, 07:30 AM   #5
pixellany
LQ Veteran
 
Registered: Nov 2005
Location: Annapolis, MD
Distribution: Mint
Posts: 17,809

Rep: Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743
The way it is posted, I would not expect anything to work. Please edit your post with newlines as required---the format should be something like this:

Code:
magic=0x1234
j=0
for i in <command string>; do
     <command(s)>
done
**

Try running ethtool by itself.

You CAN have all this on one line, but it needs to have ";" whereever there would normally be a newline.

<<EDIT: Sorry for duplication--I was typing while colucix was posting>>

Last edited by pixellany; 06-06-2010 at 07:32 AM.
 
Old 06-24-2010, 12:48 PM   #6
Super TWiT
Member
 
Registered: Oct 2009
Location: Cyberville
Distribution: Debian
Posts: 132

Original Poster
Rep: Reputation: 16
Hey colucix I tried what you wrote above, and it looked like it worked (it echoed things to the command line) but when I compared the image dump from my ethernet card, nothing changed. I was root when I ran everything. I am not blaming you, it was the site I got it from. Any ideas? The site is here.
 
  


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
setup command not found in Ubuntu 10.04 Command Prompt vinaytp Ubuntu 2 05-06-2010 01:10 PM
Shell: command not found / Runs fine with "Run command" badbunny Linux - Newbie 1 01-22-2007 01:21 AM
bash: rpm: command not found && sudo: alien: command not found Java_Code Ubuntu 7 07-27-2006 11:57 PM
bash: <command name> command not found smash Programming 5 03-13-2006 08:48 AM
cd.. command not found?!? xtremcoder Fedora 4 10-06-2004 04:43 PM

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

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