Home Man
Search
Today's Posts
Register

BSD, Linux, and UNIX shell scripting — Post awk, bash, csh, ksh, perl, php, python, sed, sh, shell scripts, and other shell scripting languages questions here.

HOW: Shell script accessing files located in individual logged in user.

Tags
shell scripts

Login to Reply

 
Thread Tools Search this Thread
# 1  
Old 05-02-2011
Java HOW: Shell script accessing files located in individual logged in user.

Hi
I have below scenario, I hope this could be possible, but as of now no idea how to implement this.

Mount point in this location /abc/mp, and there will different users who will be executing one the file shell1.sh file located in /abs/mp, but every user will execute this shell1.sh file from their login
(somtehing like this /aaa/bbb/home/usr1)

I am sure that above step can be implemented by creating link in /abc/mp for each individual users

Now real question is
In my shell1.sh file which is in /abc/mp, have to pick one of the file dynamically (I mean not hardcoded path/file) from certain folder for logged in user

i.e. for example
- File in /abc/mp is shell1.sh
- Individual logged in user is usr1

So usr1 will execute this shell1.sh file using link

The shell1.sh should be able to pick the file namely mydatafile.txt from individual logged in user from certain folder in /aaa/bbb/home/usr1/dump

(Similarly if usr2 executes this shell1.sh then shell file should able to pick mydatafile.txt located in usr2's location that is /aaa/bbb/home/usr2/dump )

I just like to know how this can be implemented, might be very simple but I am not aware of this.

Regards
jc
# 2  
Old 05-02-2011
There is an environmental variable called $HOME which gives the home directory of the currently logged user. Try echo $HOME
Another shortcut is the tilde '~' which refers to the user's home directory. Try echo ~/
Login to Reply

« Previous Thread | Next Thread »
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Help with running a script on files located in subdirectories azurite UNIX for Beginners Questions & Answers 3 07-01-2017 01:34 AM
• Write a shell script that upon invocation shows the time and date and lists all the logged-in user sonu pandey Shell Programming and Scripting 1 11-16-2015 04:31 AM
Executing a batch of files within a shell script with option to refire the individual files in batch goddevil Shell Programming and Scripting 2 01-09-2012 02:51 PM
shell to check user is logged on operator Homework & Coursework Questions 0 04-05-2011 07:04 AM
Shell script to display user logged last week and time connected ahernandez Shell Programming and Scripting 4 10-29-2010 02:32 PM
Shell script to display user logged in within given time meherzad4u UNIX Desktop Questions & Answers 3 09-17-2010 12:59 PM
Get current logged in user from a script run as root. hakermania Shell Programming and Scripting 7 08-18-2010 09:47 AM
batch shell script to zip individual files in directory - help wingchun22 Shell Programming and Scripting 7 03-08-2009 07:37 PM
unix shell script which inserts some records into a file located in remote servers... techychap Shell Programming and Scripting 2 11-06-2008 12:07 AM
script on user who logged in???? kim187 Shell Programming and Scripting 2 04-30-2008 05:30 AM


All times are GMT -4. The time now is 02:24 AM.

Unix & Linux Forums Content Copyright©1993-2018. All Rights Reserved.
UNIX.COM Login
Username:
Password:  
Show Password