The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com



Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Command Not Found Error? praswer Red Hat 2 07-18-2008 05:51 PM
Error ^M not found while using read command raoscb UNIX for Dummies Questions & Answers 4 05-20-2008 11:37 AM
Ambiguous and Command not found Error in UNIX koti_rama Shell Programming and Scripting 2 07-13-2007 10:42 AM
Ambiguous and Command not found Error in UNIX koti_rama UNIX for Dummies Questions & Answers 2 07-12-2007 09:44 AM
why emacs caused "command not found" error cy163 UNIX for Dummies Questions & Answers 1 05-01-2007 05:17 PM

Reply
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 07-01-2009
dahlia84 dahlia84 is offline
Registered User
  
 

Join Date: Jul 2009
Posts: 4
Command not found Error

Hi All,

This might sound like a repeated problem but I feel it quite tough to find a solution. Here is the problem.

Assume the directory structure: /a/b/c/d/e

Current shell script is ksh
There is a SomeScript.sh file in e folder it has -rwxr-xr-x permission. I belong to "Others" and I can execute it as per the permissions. This script uses some environmental variables like $ABCROOT and $CONFIG_DIR, (say) which are exported inside that .sh script (I believe. because I do not have access to the source code of this script. I can only run it).

I did a CD to /a/b/c/d/e and tried executing this script using command csh SomeScript.sh

It gave me error saying

$ABCROOT=<some path>: command not found
export: Command not found
$CONFIG_DIR<some path>: command not found
export: Command not found


I then tried to include /a/b/c/d/e in $PATH by using export command. It did not work. I tried changing the shell to csh (it does not make sense anyway), it did not work even then.

What am I doing wrong? Any one? I am using Sun OS
  #2 (permalink)  
Old 07-01-2009
scottn scottn is offline Forum Advisor  
VIP Member
  
 

Join Date: Jun 2009
Location: Zürich, CH
Posts: 1,078
Code:
$ABCROOT=<some path>: command not found
export: Command not found
$CONFIG_DIR<some path>: command not found
export: Command not found


Is this valid C shell syntax? The declarations are also not valid ksh or (ba)sh syntax.

What does line 1 of SomeScript.sh say (the "shebang")?
  #3 (permalink)  
Old 07-01-2009
dahlia84 dahlia84 is offline
Registered User
  
 

Join Date: Jul 2009
Posts: 4
I wish I knew the answer. As I said I can not view the source code and I not sure what does the shebang say.

I even tried using ./SomeScript.sh That did not work either.
  #4 (permalink)  
Old 07-01-2009
scottn scottn is offline Forum Advisor  
VIP Member
  
 

Join Date: Jun 2009
Location: Zürich, CH
Posts: 1,078
It seems to me that the problem is not with running SomeScript.sh. The problem is in SomeScript.sh itself.

You must be able to read the script. If you can't read it, you certainly can't execute it.
  #5 (permalink)  
Old 07-01-2009
dahlia84 dahlia84 is offline
Registered User
  
 

Join Date: Jul 2009
Posts: 4
I did a cat SomeScript.sh and also vi SomeScript.sh In both ways it displayed some content which is not human readable. It was some junk... looked to me like as if I did a cat on binary executable.

Thanks for coming forward to help me out though!
  #6 (permalink)  
Old 07-01-2009
scottn scottn is offline Forum Advisor  
VIP Member
  
 

Join Date: Jun 2009
Location: Zürich, CH
Posts: 1,078
Aha. A misleading filename then?! You can run

Code:
file SomeScript.sh
to see what it is.
Reply

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

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 On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 08:18 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0