9 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Hello,
I am trying to develop a script to check for valid hostnames. Below are the prerequisites for a valid hostname which I got from wiki :
Hostnames are composed of series of labels concatenated with dots, as are all domain names. For example, "en.wikipedia.org" is a hostname. Each label... (8 Replies)
Discussion started by: rahul2662
8 Replies
2. Shell Programming and Scripting
How can I validate if time (HH:MM:SS) argument is valid? I got this from web but I can't modify it to exit the script if the time argument is invalid.
echo $1 | awk -F ':' '{ print ($1 <= 23 && $2 <= 59 && $3 <= 59) ? "good" : "bad" }'
ex:
./script.ksh 12:34:21 = okay
./script.ksh... (10 Replies)
Discussion started by: erin00
10 Replies
3. Shell Programming and Scripting
Hi,
I am trying to pass a variable as an argument to another script. While substitution of variable, I am facing a problem.
varaiable "a" value should be -b "FPT MAIN".
When we pass "a" to another script, we are expecing it to get substitue as ./test.sh -b "FPT MAIN". But, it is getting... (9 Replies)
Discussion started by: Manasa Pradeep
9 Replies
4. Shell Programming and Scripting
How to check the user input to be valid using shell script?
The valid input is in the format like as follows.
1. It can only have r,w,x or a hyphen and nothing else.
2. ensure the r, w, x are in the correct order.
for example: rwxr-xr-x is a valid format.
Thanks (5 Replies)
Discussion started by: hyeewang
5 Replies
5. Shell Programming and Scripting
I want to make a script that check for the argument passed to it and generates an error in case any character/string argument passed to it.
I am using below code, but its not working. can anyone help.
#!/bin/bash
if ]; then
echo 'An integer argument is passed to the script hence... (3 Replies)
Discussion started by: mukulverma2408
3 Replies
6. Shell Programming and Scripting
I need to check if an account has a valid password.
Would something like this work?
read ACCNAME
if grep -q "^$ACCNAME:\$6:" /etc/shadow; thenI noticed every entry in my shadow file that has a password starts with $6 ... it works for my current setup, but would it always work? I can't test... (4 Replies)
Discussion started by: ADay2Long
4 Replies
7. Homework & Coursework Questions
1. The problem statement, all variables and given/known data:
The script usage will be as follows:
library.third source_directory
- Your script will display an appropriate error message and exit with status 3 if no parameters are given
- Your script will display an appropriate error... (2 Replies)
Discussion started by: netmaster
2 Replies
8. Shell Programming and Scripting
I have a script file. test.sh
I am running it by command
sh test.sh 10102004
where 10102004 is the script argument.
I wan to assign this 10102004 to a variable.
How can i do this?
I tried &1 and awks ARGV its not working :( (2 Replies)
Discussion started by: rohankit
2 Replies
9. Shell Programming and Scripting
Hi i am using a shell script for renaming the files and placing in the remote location(FTP) my code is:
cd $1
day=$(date +%d)
for i in `ls -1 BBW*`
do
last=`tail -1 $i`
pat=`expr "$last" : '.*(\(.*\)).*'`
pat=`echo $pat | sed 's/ /_/'`
pat=$pat$day
mv $i $pat
rm -f $day
done... (3 Replies)
Discussion started by: srivsn
3 Replies