Today (Saturday) We will make some minor tuning adjustments to MySQL.

You may experience 2 up to 10 seconds "glitch time" when we restart MySQL. We expect to make these adjustments around 1AM Eastern Daylight Saving Time (EDT) US.

Help needed - Script

Login or Register to Reply

Thread Tools Search this Thread
# 8  
Originally Posted by RudiC
If you forgo the required error message, this could work for you:
echo "$1's home directory is $(grep $1 /etc/passwd | cut -d: -f6)"

To produce the error checking and message, a serious detour must be taken, and we need to know what your OS and shell versions are.
This can produce multiple answers if $1=ann and both ann and anna are users in /etc/passwd
This User Gave Thanks to jgt For This Post:
# 9  
@jgt: absolutely, thanks. Try grepping for "^$1:"
# 10  
With bash,zsh,ksh the ~$var expansion works in eval.
eval home=~$1
echo "$1's home directory is $home"

  • eval is evil. Make it as short and simple as possible!
  • in csh it works without eval. The whole csh is evil!

Last edited by MadeInGermany; 04-26-2019 at 07:31 AM.. Reason: Optimized
Login or Register to Reply

Thread Tools Search this Thread
Search this Thread:
Advanced Search

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Help Needed on Script

Hi team, I am looking to execute some command through xargs. $cat testfile | grep myloc alias myloc='cd /export/nfs-1sv-23/' I am trying to execute that alias as soon as i cat and grep ? I tried with $cat testfile | grep myloc | xargs --> no luck ... Can some one assist me with... (6 Replies)
Discussion started by: itsme488
6 Replies

2. Shell Programming and Scripting

Script needed

Here is a file that I want to run a script to do the following File Content: 0883318739,13010,A,300,abcde 0880123456,5433,C,200,xcvfe 0882344242,4233,N,204,ghfsa Script to be get: Try to have a script that can match all the below criteria 1st field range from 08801xxxxx to 0882xxxxxx... (6 Replies)
Discussion started by: ahmed_as8
6 Replies

3. UNIX for Dummies Questions & Answers

help in script needed

Hi, I am developing a script for writing out the failed jobs in file, 1)First step i need to create an empty file Status with today's date. 2)After that i need to execute the below command: dsjob -server servername -user uname -password pwd -ljobs projectname This will listout all... (5 Replies)
Discussion started by: pandeesh
5 Replies

4. Shell Programming and Scripting

Expect script help needed- script failing if router unavailable

Hey all. Sometimes I'm tasked to change some router configs for the entire network (over 3,000 Cisco routers). Most of the time its a global config parameter so its done with a loop and an IP list as its the same configuration change for all routers. This is working OK. However, sometimes an... (3 Replies)
Discussion started by: mrkz1974
3 Replies

5. Shell Programming and Scripting

Script needed...

Hi! I have a file which has the following entry - which has different service names with their corresponding URLs. I want to echo the servicenames and curl each URL and find out if the URL is accessible or not. (2 Replies)
Discussion started by: jacki
2 Replies

6. Shell Programming and Scripting

Script needed...

Hi! I have a file which has a list of host, I want to ssh to each of the first box for an app and grep through the logs for version of the application and look for a certain string "Connection is open" in the log file. The file I am referring to looks like this - ... (1 Reply)
Discussion started by: jacki
1 Replies

7. Shell Programming and Scripting

Help needed with script.

Hi, Basically I am looking to search for a certain string within a log file. If this string is present then I want to send an output file with the results of this string in it to me by email. If the output file has 0 as it's result the we email a successful backup. Script is below. ... (5 Replies)
Discussion started by: sparcman
5 Replies

8. Shell Programming and Scripting

help needed for a script!!

Hi!! Im new to shell scripting. I have an important assignment to complete in my company tomorrow. Please help me. I have to write an interactive script which does the following thing: There is a file named ""rules"in a folder say /home/f1/ . This file contains text in the form: 123 345... (5 Replies)
Discussion started by: rahul195
5 Replies

9. Shell Programming and Scripting

Script needed

Hi I am looking for the script which can move 1month old data from a TXT file.actully in this file data is appended on daily basis.pleasehalp me out. Thanks in advance (3 Replies)
Discussion started by: vpandey
3 Replies

10. Shell Programming and Scripting

help needed! my first script

Create a file with x amount of lines in it, the content of your choice. Write a script named 'firstline' that takes two arguments. The first being a line of text, the second being your newly created file. The script should take the first argument and insert it into the very top (the first line)... (1 Reply)
Discussion started by: fcbarcelona1984
1 Replies

Featured Tech Videos