LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 04-21-2010, 04:54 PM   #1
ssrobins
LQ Newbie
 
Registered: Apr 2010
Posts: 4

Rep: Reputation: 11
Shell script doesn't think a directory is valid (but it is)


I've successfully built a library I'm using on Ubuntu Linux 8.04 (both x86 and x86-64) and now I'm building it on SuSE Linux 9.1 (x86-64). I set the environment variable required for the make script exactly as I set it on the other Linux computers. When I run the make script, I get an error citing that $DEVDIR, which is the root development directory, is not a valid directory. Here's the pertinent part of the script I'm running:

Code:
#!/bin/sh

if test "$DEVDIR" = "" ; then
  echo "Err: DEVDIR undefined...."
  exit;
fi

if test ! -d $DEVDIR ; then
  echo "invalid development root directory:  $DEVDIR"
  exit;
fi
Running this on Ubuntu won't output any errors, but running it on SuSE will give me this error:
invalid development root directory: $DEVDIR
(In place of $DEVDIR, it's showing the actual path to the directory)

So the terminal sees the environment variable (confirmed this with the "env" command), but it doesn't think the variable describes a valid directory. I cd to that directory, copying the contents of $DEVDIR and it works perfectly fine. I even cd'd to / and followed the path all the way to $DEVDIR. There were alternate paths to that directory using links, but I made sure to use the real path.

Stranger still, I had the same problem when trying to run it from the terminal in Apple OSX 10.5 (PowerPC). I figure I'm missing some sort of configuration. Does anyone know what it is?

Last edited by ssrobins; 04-21-2010 at 05:15 PM.
 
Old 04-21-2010, 05:01 PM   #2
catkin
LQ 5k Club
 
Registered: Dec 2008
Location: Tamil Nadu, India
Distribution: Debian
Posts: 8,578
Blog Entries: 31

Rep: Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208
Is that the exact error message, "invalid development root directory: $DEVDIR"?
 
Old 04-21-2010, 05:14 PM   #3
ssrobins
LQ Newbie
 
Registered: Apr 2010
Posts: 4

Original Poster
Rep: Reputation: 11
Quote:
Originally Posted by catkin View Post
Is that the exact error message, "invalid development root directory: $DEVDIR"?
No, sorry for being unclear. It really shows the actual path that is stored in the $DEVDIR variable.
 
Old 04-21-2010, 05:46 PM   #4
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,415
Blog Entries: 55

Rep: Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600
Run script as 'sh -vx scriptname' then post the relevant parts containing variables and tests?
 
Old 04-21-2010, 09:23 PM   #5
ssrobins
LQ Newbie
 
Registered: Apr 2010
Posts: 4

Original Poster
Rep: Reputation: 11
Quote:
Originally Posted by unSpawn View Post
Run script as 'sh -vx scriptname' then post the relevant parts containing variables and tests?
Here's the output of 'sh -vx scriptname' on Ubuntu:
Code:
#!/bin/sh

if test "$TECADDONDEVDIR" = "" ; then
  echo "Err: TECADDONDEVDIR undefined...."
  exit;
fi
+ test /duwamishvm03/steve/Desktop/add-on = 

if test ! -d $TECADDONDEVDIR ; then
  echo "invalid addon development root directory:  $TECADDONDEVDIR"
  exit;
fi
+ test ! -d /duwamishvm03/steve/Desktop/add-on
And here's what it looks like on SuSE:
Code:
#!/bin/sh

if test "$TECADDONDEVDIR" = "" ; then
  echo "Err: TECADDONDEVDIR undefined...."
  exit;
fi
+ test $'/home/users/steve/add-on\r' = ''

if test ! -d $TECADDONDEVDIR ; then
  echo "invalid addon development root directory:  $TECADDONDEVDIR"
  exit;
fi
+ test '!' -d $'/home/users/steve/add-on\r'
' echo 'invalid addon development root directory:  /home/users/steve/add-on
invalid addon development root directory:  /home/users/steve/add-on
+ exit
Whoa, what's that "\r" business? Looks like that linebreak either came from Gedit from Ubuntu, TextEdit from the Mac, or Notepad++ from Windows. None of those showed it, but "vi" did. Thanks for the suggestion, unSpawn, I really appreciate it!
 
  


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 On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
How to change directory in a shell script? jdupre Linux - Newbie 13 06-25-2015 05:03 AM
Walking through directory Shell script knockout_artist Linux - Newbie 6 09-25-2008 10:17 AM
Shell script help: How to pass a directory path to the script? dv502 Programming 13 09-10-2008 03:07 AM
Directory listing - Calling shell script from a CGI script seran Programming 6 08-11-2005 11:08 PM
shell script: delete all directories named directory.# except directory.N brian0918 Programming 3 07-13-2005 06:54 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

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