if [ ! -f $FILE ]; then
echo "$FILE : does not exists" exit 1
elif [ ! -r $FILE ]; then
echo "$FILE: can not read"
exec 0< $FILE
while read line
I will be passing names.txt as a command line arg.which contains 10 names . Where each of those names have different HOMEDIR from where we can search the file and get the data. My problem is that i know the HOMEDIR of my name jason( /home/jason/). But i dont know the HOMEDIR for other names. So how i can find the HOMEDIR for other names and for there how can search the example.dat and example1.dat(which is common for all names) and get the respective data?
I have used "~" like "~ /example.dat" but it is getting me the HOMEDIR of the current working directory.
How to solve this problem. One more problem is that when this script is invoked twice, the data's for the same name is appended twice because of ">>". I dont need that where i need to delete the file sample.txt (if it exists), each time when the script is invoked so that i will get only the data for partcular name once. Please do provide a solution for this..
Thanks Madhan, the sed line will get the data for the element data-1.
What is the command to get the HOMEDIR values from /etc/passwd. Where i need to set the HOMEDIR in a variable and then pass it to the "sed" command.
Some thing like :-
I have made password less connection to my remote account. and i tried to execute commands at a time. but i am unable to execute the commands.
cd ~/JEE/*/logs/ (1 Reply)
I am writing a switch case statement and one of the option contains sudo to a particular user and then perform some steps after that but my script is unable to proceed with further execution after doing sudo over the user. Could you please suggest an workaround for this. (1 Reply)
I am writing a BASH script to update a webserver and then restart Apache. It looks basically like this:
rsync /path/on/local/machine/ foo.com:path/on/remote/machine/
ssh foo.com sudo /etc/init.d/apache2 reloadrsync and ssh don't prompt for a password, because I have DSA encryption... (9 Replies)
I have small issue...
I used to pass the passwd for sudo commands like below,
gzcat ~/passwd.gz | sudo su - <villin> >> eof
And it was able to login into "villin" sudo account successfully. But now, I'm using the same in another script for the... (2 Replies)
I am faceing lot of problem due to "disk space is not enough".
senerio is like as,
In system has 5 account.
say account c if very critical.
Due to other user's data, user 'c' is faceing disk space issue.
I want to dedicate 3 GB for user 'c'.
No user... (1 Reply)
I have access to 15+ UNIX boxes at work, and I do not consistently log onto all of them over time. When I do try to access one I havent been on in awhile, my account is locked as the password has expired.
I need to request to the UNIX SA's that the password expiration is 90 days and that if it... (1 Reply)
Is there a way to easily change an account to be a non login account (NP in the shadow) file?
I know I can just edit the file but that is not what we want to do. We use access control software and want to provide a way to set an account to be non-login using simple commands that can be mapped... (0 Replies)