Let me start by stating this question is for homework help (not "help, my boss needs this ASAP")
I have spent the last few days re-visiting this script, and cannot figure out where I am going wrong (something simple I'm sure).
I am to build a script that searches for a user within the ~/SLASH/etc/passwd file, and return the line of the file that contains the user name.
Execution of the script will look like [userlookup.sh bob]
I am sure there are better commands to use, but [cat ~/SLASH/etc/passwd | grep (user input)] is the desired command to display the results. Testing the command at the shell prompt [cat ~/SLASH/etc/passwd | bob] does work, I'm just not sure where I'm going wrong bringing that command to this script:
The shell returns "no such file or directory" (relates to my 'output' line).
Also returns "Cannot find user", even though "bob" is definitely in the file.
(If inputted name is not found in the file, then "Cannot find user" is returned)
Last edited by jjc032681; 07-02-2017 at 10:22 PM..
Reason: Code did not insert
Hi All
I need to pass country code into a pipe delimited file for lookup.
It will search country code (column 3) in the file, if the country code matched, it will return value from other columns.
Here is my mapping file.
#CountryName|CountryRegion|CountryCode-3|CountryCode-2... (5 Replies)
Hi,
I need to switch from local user to root user in a shell script.
I need to make it automated so that it doesn't prompt for the root password.
I heard the su command will do that work but it prompt for the password.
and also can someone tell me whether su command spawns a new shell or... (1 Reply)
Hi Every body,
I would need a shell script program to login as different user and perform some copy commands in the script.
example: Supppose ora_toms is the active user
ora_toms should be able to run a script where user: ftptomsp pass: XXX should login through and run the commands
... (9 Replies)
Hi Experts,
I had tried to executes this script to change the user password through script:
No lines in buffer
#!/bin/ksh
cat /etc/passwd | grep -v userid >> /tmp/pass.tmp1
cat /etc/passwd | grep userid >> /tmp/pass.tmp2
PASS1=`cat /tmp/pass.tmp2 | cut -d ":" -f2`
PASS2=`q2w3e4r5`
sed... (3 Replies)
Hi All
I have written one shell script for GPRS route add is given below named GPRSRouteSet.sh
URL="www.google.com"
VBURL="10.5.2.211"
echo "Setting route for $URL for GPRS"
URL_Address=`nslookup $URL|grep Address:|grep -v "#"|awk -F " " '{print $2}'|head -1`
echo "Executing ... (3 Replies)
Hi
I have one properties file containing as
$INSTALL_BASEPATH/mssages/commonmessages_default.properties
$INSTALL_BASEPATH/resource/configurationBundle.properties
and $INSTALL_BASEPATH is set in .bash_profile
but from shell script when I read this file
and use in copy statement then it... (7 Replies)
Write a quick shell snippet to find all of the IPV4 IP addresses
in any and all of the files under /var/lib/output/*, ignoring
whatever else may be in those files. Perform a reverse lookup on
each, and format the output neatly, like "IP=192.168.0.1,
... (0 Replies)
Hi all,
I am trying to eject the cdrom from a livecd after certain stage...
Now assuming that it is possible to eject,please consider my issue!!!
The OS boots into a regular user by default...so i am unable to use the eject command to push out the drive...
However if i try pfexec eject it... (3 Replies)
Hi All.,
i have a problem. I hope i can get some help on this issue here;
i have 2 txt files say file1 and file 2
file1 has;
WLMT:XXXXXXXX:cp
DOLR:YYYYYYY:ascii,unblock
WLG:TTTTTTT:dd:73:ascii,unblock
MAR:SSSSSS:dd:152:ascii,unblock
GGG:QQQQQQQQQQ:112:ascii,unblock
EIE:CCCCCCCC:cp... (17 Replies)