We have a script that runs in ksh on HP-UX 11.11. It takes three arguments. The last argument can be a filename or wildcard character. For example:
script -s hello -t goodbye '*.d*'
In a case such as this, I would wrap single quotes around the final argument because I dont want the shell to... (4 Replies)
#!/usr/bin/bash
if
then
echo "Not valid arguments entered. Just username should be entered."
else
USER_NAME=$1
FILE_NAME=$USER_NAME.info
UNN=STUDIN\\\\$1
echo $UNN
last STUDIN\\\\$1
last UNN
If I type `last STUDIN\\eip060` it works but if I try to expand it with variable it is... (5 Replies)
Hello -
I have a bash script which does some logging, and I'd like to include the line number of the echo statement that pipes into $LOGGER:
MYPID=$$
MYNAME=`basename $0`
LOGGER="/usr/bin/logger -t $MYNAME($LINENO) -p daemon.error"
...
echo 'this is an entry into the log file' | $LOGGER
... (3 Replies)
I'm in the habit of using the following type of loop structure:
for num in `seq $1 $2`
do
command
doneWhile `seq $1 $2` is not exactly a huge resource hog, I would like to learn a better way. It seems that brace expansion is a good way to go:
for num in {3..10}The problem, though, is... (2 Replies)
i write a batch file , here is the content.
dirname='date +%Y-%m-%d'
mkdir dirname
but it doen's work, it just create a folder named date and +%Y-%m-%d.
i have tried run the command seperately in the bash prompt. after the first
sentence executed , i use $dirname to watch the value of... (4 Replies)
The objective of the code below is to create sed script to be later executed. However, it bonks because $ARCHIVENAME expands to a directory specification so the forward slashes cause problems. I can think of a few solutions that would involve redesigning the process, but I'm hoping there might be... (4 Replies)
Hi forum,
in my bash script I've many lines executing commands with redirection to log files.
...
xyz_cmd 2>&1 > $BASENAME.$LINENO
The trailing part of these lines doesn't look nice and I like to put it into a variable.
The (not working) idea is something like that
... (3 Replies)
So, I was bored on the train today, and was thinking of ways to loop through elements of an array. I came up with the following simple script, but it doesn't work as brace expansion doesn't seem to work with variables. Is there something I'm missing, or does the shell just not work like this?
... (4 Replies)
Hello,
I have one variable coming from one file:
abc=$xyz/filename.txt where $xyz is defined in .profile file as say, /usr/dev/src
i am passing abc variable to one perl script as input parameter.
perl 123.pl -s $abc
But inside the perl script execution, the variable $abc is just... (1 Reply)