Basic Solaris Question


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers Basic Solaris Question
# 1  
Old 09-05-2009
Basic Solaris Question

In solaris, if i try to make a new file

Touch /blah/blah/cookie/file.txt

and /cookie doesnt exist will solaris be a good os and create the path for file.txt?

Or will i need to do a test loop for directory existance in my script?
# 2  
Old 09-05-2009
i think no OS will do this with the "touch" command... "mkdir -p" will create all subdirectories to the given path... but not "touch".
# 3  
Old 09-07-2009
I don't think any command will create directory structure before creating file. It can create file if not exists. You should check if the directory structure exists or not then create the file. Like
Code:
if [-d /blah/blah/cookie]
{
mkdir -p /blah/blah/cookie
touch /blah/blah/cookie/file.txt
}
else
{
touch /blah/blah/cookie/file.txt
}

# 4  
Old 09-09-2009
Thank you for your help Smilie My script is functioning properly now.
 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Solaris

Jumpstart basic question

Hello All, Do I really need to add the install server name in the /etc/hosts file? Why do we need to add? If I don't add it is not working. Isn't it only arp/rarp works here? I thought it works in mac address level. thanks in advance. (3 Replies)
Discussion started by: mokkan
3 Replies

2. Shell Programming and Scripting

basic nc question

i'm doing this in one terminal: nc -lu 7402 and it appears to start listening properly, then in another i do this: echo "hello" | nc -u localhost 7402 and nothing happens on the listening terminal - what am i doing wrong? thanks. (7 Replies)
Discussion started by: peterworth
7 Replies

3. Shell Programming and Scripting

basic question

hi, I have a basic question,, i am in a directory called /intas/OCU_3.9.1/sbin ocuut1@france>mv itsa_tcs itsa_tcs_old mv: itsa_tcs_old: rename: Permission denied i am logging as the owner of the file. when i am doing this i am getting the above error of permission denied. I know... (3 Replies)
Discussion started by: namishtiwari
3 Replies

4. UNIX for Dummies Questions & Answers

SunOS basic question

Hello everybodyI have connected an external tape drive onto my Sun Spark station running Sun OS 4.1.3. since am in the basic elementary stage in Sun OS, can someone answer the below questions pls 1) after connecting the tape drive to a server and rebooting does /dev/st0 show up automatically?... (3 Replies)
Discussion started by: karthikosu
3 Replies

5. HP-UX

Basic OS question

Could someone tell me the command to find out the OS version which will give 12 character not the 9 characters(which is usually machine id). uname -i gives machine id and uname -a is more comprehensive way to look. Thanks! (4 Replies)
Discussion started by: catwomen
4 Replies

6. UNIX for Dummies Questions & Answers

Really basic question....

Hello all. Let me start off by saying I know a little more then it seems by me asking this question... here goes I have an old 486 box and I want to start messing around with unix. I've been taking classes for 3 or 4 years in c programming in unix, so I am used to the commands and such, but I... (1 Reply)
Discussion started by: robherms
1 Replies

7. UNIX for Dummies Questions & Answers

Very Basic Question

How to know if my AIX 5.2 is running at 64bits? THANKS (5 Replies)
Discussion started by: GermanSkull
5 Replies

8. UNIX for Dummies Questions & Answers

basic question

hey...when i type who...what does "pts" field mean??? eg pts 0 etc (1 Reply)
Discussion started by: urwannabefriend
1 Replies

9. UNIX for Dummies Questions & Answers

basic question about shells?

I have come across the topic of changing shells, does that mean that all Unix operating systems comes with a variety of shells built in and its up to the user to select a shell of his/her choice? (2 Replies)
Discussion started by: wmosley2
2 Replies

10. UNIX for Dummies Questions & Answers

basic question

I have some basic doubts. Can someone clarify in this forum? 1)if then eval ' tset -s -Q -m ':?hp' ' else eval ' tset -s -Q ' what does it exactly mean in .profile? 2) what are 'nobody' and 'noaccess' usernames in /etc/passwd file. ... (3 Replies)
Discussion started by: asutoshch
3 Replies
Login or Register to Ask a Question