Accessing the home directory in shell script


 
Thread Tools Search this Thread
Operating Systems Solaris Accessing the home directory in shell script
# 1  
Old 05-20-2005
Accessing the home directory in shell script

How can I access home directory in a shell script.

I am writing a script which will delete the log files in each of the user's directory

Krishan
# 2  
Old 05-21-2005
The easiest way would be with find

find /home -type f -name "log_i_want_to_delete.log" -exec rm {} \;

of course, depending on OS, home dirs might be under /export/home

If there are only a few users, and the log is always in the same place, a simple

cd /home && rm */whatever.log

would do it.

Cheers
ZB
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Shell script to find weblogic home directory

Hi, I am trying to find the weblogic home directory whether it is installed in the Linux box. if it is existing display the weblogic home and the corresponding Java home directory else display message as that wl home does not exist. I already wrote a program but it was not working properly.... (11 Replies)
Discussion started by: spgreddy
11 Replies

2. UNIX for Advanced & Expert Users

Accessing secured server using shell script

Hi, I was trying to connect secure server using SFTP, but end up in error. Im looking for a shell script which will connect my secured FTP server For EG: hostname = example.com username = fed password = pass port = 993 Destination = web Push some tar file into web folder which is in... (3 Replies)
Discussion started by: Paulwintech
3 Replies

3. Shell Programming and Scripting

Get Home Directory for Users in Login Hook Script

I'm writing a script to use as a LoginHook for my Mac users. As part of this script, I need to write to a location in their home directory, but I can't seem to access the path - at this point in the login process, $HOME is empty and ~ gives the path to root's home. Unfortunately, I can't just do... (1 Reply)
Discussion started by: blondepianist
1 Replies

4. Shell Programming and Scripting

script to check for a directory in /home for all users

Following on from this post: https://www.unix.com/shell-programming-scripting/150201-simple-script-mount-folder-all-users-home.html and getting told off for bumping the thread:( Please could someone help me with a short script to check is a certain directory is present in /home for all users... (8 Replies)
Discussion started by: barrydocks
8 Replies

5. Linux

accessing a Debial home doc when booted ob Ubuntu

Sure it's been covered before my key words probably wrong for search, but I have a triple boot operate mostly in Ubuntu and would like to access debian files to see them without re-booting My first post and great to be here Thanks (1 Reply)
Discussion started by: worthamtx
1 Replies

6. Shell Programming and Scripting

Accessing aliases within a shell script

I am not able to access the aliases in my environment within a Python script. If I pass the alias to os.system(), I get a message saying "sh: x: not found". I've tried sourcing my .bashrc file in the script, but this does not work. I would perfer not to source my or any rc file because this... (9 Replies)
Discussion started by: cooldude
9 Replies

7. Shell Programming and Scripting

Accessing the parameters of a shell script

Hi, I have one situation. I am developing a shell script to which parameters will be passed from a Web based User Interface using some Business Process(BP).There are some 6 parameters for which user will enter the values in UI. These values will be passed to script by BP in the form -... (2 Replies)
Discussion started by: The Observer
2 Replies

8. Shell Programming and Scripting

get home-directory in shell-scripts

Hi, does somebody know, how i can get the full path of my home-directory in a shell-script? But not with the $home-variable or ~ (i don't know for sure, but i think this does not work in every shell...). Thank You! Greetings, qsi (5 Replies)
Discussion started by: qsi
5 Replies

9. Shell Programming and Scripting

Accessing var from .profile into shell script

I have defined variable in .profile file. This variable, I tried to use in a shell script for the same session. In Shell script it is not finding this variable, but the same variable on the console if I try to access by echo $var, it is giving me correct assigned value. Can anyone, please... (7 Replies)
Discussion started by: videsh77
7 Replies
Login or Register to Ask a Question