Unix/Linux Go Back    


Shell Programming and Scripting 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.

Shell Programming and Scripting


Closed    
 
Thread Tools Search this Thread Display Modes
    #1  
Old Unix and Linux 05-02-2011   -   Original Discussion by shekharjchandra
shekharjchandra's Unix or Linux Image
shekharjchandra shekharjchandra is offline
Registered User
 
Join Date: Nov 2010
Last Activity: 19 August 2011, 10:24 AM EDT
Posts: 30
Thanks: 7
Thanked 0 Times in 0 Posts
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
Sponsored Links
    #2  
Old Unix and Linux 05-02-2011   -   Original Discussion by shekharjchandra
frans's Unix or Linux Image
frans frans is offline Forum Advisor  
Registered User
 
Join Date: Oct 2009
Last Activity: 1 February 2016, 9:47 AM EST
Location: France
Posts: 839
Thanks: 4
Thanked 54 Times in 53 Posts
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 ~/
Sponsored Links
Closed

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Linux More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
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
batch shell script to zip individual files in directory - help wingchun22 Shell Programming and Scripting 7 03-08-2009 07:37 PM
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:27 PM.