11-18-2009
So, thanks, two questions...
1: The slashes prior to the dollar sign in dir1 and dir2, are those there for a reason?
2: Will removing the quotes from dir2's use of variabledir cause the -subdirectory to be appended, or would it be treated as a full and new variable with a dash in the name?
EDIT: 2 is not an issue, and I'm not sure why the slashes helped, but they did. Thanks a bunch!
Last edited by karlp; 11-18-2009 at 02:28 PM..
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Hi,
I have a program that searches for a particular string patten. I am however having difficulty passing the varible $i (in a loop) as the string pattern to replace. Using either perl or sed search and replace statements, I get the same kinda result. For example, using the perl:
for i in... (3 Replies)
Discussion started by: Breen
3 Replies
2. Shell Programming and Scripting
Bash : how do i check the user input and make sure is only character or only number ? (7 Replies)
Discussion started by: CheeSen
7 Replies
3. Shell Programming and Scripting
I'm working on making a menu system on an HP-UX box with Bash on it. The old menu system presents the users with a standard text menu with numbers to make selections. I'm re-working the system and I would like to provide something more akin to iterative search in Emacs.
I have a list of 28... (2 Replies)
Discussion started by: deckard
2 Replies
4. UNIX for Dummies Questions & Answers
Hey, im trying to validate a user input and need some help. The input needs to be just a single letter. Im using a case to so this eg:
read answer
case $answer in
*) echo "OK"
;;
*) echo "This is a number"
read answer
;;
*) echo... (2 Replies)
Discussion started by: 602chrislys
2 Replies
5. Shell Programming and Scripting
Hi all, I currently have a script which uses read -p for user interaction. e.g.
read -p "New user? " user
Is it possible to have it so if the user enters nothing and just presses return it can resort to a specified value instead?
Thanks! :) (5 Replies)
Discussion started by: JayC89
5 Replies
6. Shell Programming and Scripting
I am starting to learn how to use bash and I would like the script to do the following:
Asks the user for his/her name
Asks the user for one number
Asks the user for another number
Then it adds the two numbers,
Also multiply the two numbers
I have the part where you get the name, and I... (3 Replies)
Discussion started by: boyboy1212
3 Replies
7. Shell Programming and Scripting
hi all,
i have a script that need user input provide all variables that needed to complete a job.
this is my current script:
echo "type file source and it full path :"
read INPUTFILE
if || ;
then
echo "ERROR: you didn't enter a file source or file source is not... (2 Replies)
Discussion started by: makan
2 Replies
8. Shell Programming and Scripting
Below is a simple script to prompt for user input while suggesting an editable default value at the prompt:
shortname=user1
read -e -i $shortname -p "Please enter the username you would like to add: " input
USERNAME="${input:-$shortname}"
Please enter the username you would like to add:... (3 Replies)
Discussion started by: woodson2
3 Replies
9. Shell Programming and Scripting
Hello.
I am running 2 scripts : script_1 and script_2
These scripts are run as root
Script 2 contains :
#!/bin/bash
#
# ~/bin/script_2
#
E_BAD_PARAM=115
#
date2stamp () {
date --date "$1" +%Y-%m-%d___%H:%M:%S
}
#
USER_NAME=$1
NB_PARAM=$#
PARAM0=$0 (2 Replies)
Discussion started by: jcdole
2 Replies
10. Shell Programming and Scripting
I have the basic command written in bash
for element in 1 2
do
if ]; then
set el = "t"
else
set el = "p"
fi
done
but i get the following error
syntax error near unexpected token `for'
` for element in 1 2'
What should i do differently? (3 Replies)
Discussion started by: ncwxpanther
3 Replies
LEARN ABOUT HPUX
setuname
setuname(1M) setuname(1M)
NAME
setuname - change machine information
SYNOPSIS
name] node]
DESCRIPTION
The command is used to modify the value for system name and/or the node name by using the appropriate option(s).
The command attempts to change the parameter values in both the running kernel and the system configuration to cross reboots. A temporary
change affects only the running kernel.
Options
The command supports the following options:
Changes the system name (for example, HP-UX) in the
field of the structure where name is the new system name and consists of alphanumeric characters and the special
characters dash, underbar, and dollar sign.
Changes the name in the
field of the structure where node specifies the new node name and consists of alphanumeric characters and the special
characters dash, underbar, and dollar sign.
Signifies a temporary change.
The change will not survive a reboot.
Either or both of the or options must be given when invoking
The size of the name and node is limited to characters. is defined in Only users having appropriate privileges can use this command.
EXAMPLES
To permanently change the system name to and the node name to issue the following command:
To temporarily change the system name to and the node name to issue the following command:
WARNINGS
Setting a nodename of more than 8 bytes is possible only with the appropriate configuration options enabled. It is strongly recommended
that all related documentation be completely understood before setting a larger node name. A node name larger than 8 bytes can cause
anomalous or incorrect behavior in applications which use the command or the system function to access the name.
SEE ALSO
uname(1), uname(2), nodehostnamesize(5).
setuname(1M)