LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Other *NIX Forums > Solaris / OpenSolaris
User Name
Password
Solaris / OpenSolaris This forum is for the discussion of Solaris, OpenSolaris, OpenIndiana, and illumos.
General Sun, SunOS and Sparc related questions also go here. Any Solaris fork or distribution is welcome.

Notices


Reply
  Search this Thread
Old 04-30-2010, 01:40 AM   #1
nagendrar
Member
 
Registered: Apr 2008
Location: HYD, INDIA.
Posts: 154

Rep: Reputation: 15
how to check directory exist or not


I am checking whether directory exist or not using shell script following way

if ! [ -d ./images ]
then
mv ./Images ./images
fi

In Linux, it works successfully.
But it fails in Solaris and gives "!: not found" error . How can I overcome this.

Please help

ThanQ,
Nagendra
 
Old 04-30-2010, 02:06 AM   #2
jlliagre
Moderator
 
Registered: Feb 2004
Location: Outside Paris
Distribution: Solaris 11.4, Oracle Linux, Mint, Debian/WSL
Posts: 9,789

Rep: Reputation: 492Reputation: 492Reputation: 492Reputation: 492Reputation: 492
Code:
if [ ! -d ./images ]
then
 mv ./Images ./images
fi
 
  


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
Check if users exist in the system hindll01 Programming 12 09-28-2012 02:24 PM
check if directory exist jaepi Programming 6 05-10-2007 08:45 PM
Check if email exist or not proNick Linux - Software 2 08-27-2005 01:25 PM
How to check if a software exist in my computer Niceman2005 Linux - Newbie 4 12-28-2004 09:12 PM
How to check if array[0] doesn't exist? flamesrock Programming 3 11-05-2004 10:36 AM

LinuxQuestions.org > Forums > Other *NIX Forums > Solaris / OpenSolaris

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