Skip to main content

All Questions

Tagged with
1 vote
2 answers
32k views

How to compare strings in ksh

I want to check the result of a job and execute an action on FAILED. First: I grep the last word of the line in my application logfile (for the recent processed file ($processedfilename)): check1=$(...
Vince's user avatar
  • 23
1 vote
2 answers
1k views

Unable to store ascii value in a variable

I am trying to convert hex to decimal to ascii and store it in a variable. I am using the following code. HEX=30 DEC=`printf "%d\n" 0x${HEX}` echo "$DEC" ASC=`printf \\$(printf '%03o' $DEC)` echo "$...
ayrton_senna's user avatar
  • 1,091
2 votes
2 answers
734 views

Meaning of \ before environment variable

In ksh on an old Solaris box I used: export PS1="$PWD $" to set the prompt to the current directory. It works great until you cd elsewhere, then you see that it's not evaluating PWD each time. I ...
user avatar
1 vote
3 answers
1k views

Quoting in command substitution

The command pdftk FileOne.pdf "File two.pdf" output Combined.pdf works as expected, merging PDF's One and Two. However, if I put the filenames in a file FileOne.pdf "File Two.pdf" and ...
Michael's user avatar
  • 11
8 votes
4 answers
49k views

using awk to split a line on single spaces not multiples

I'm trying to split a line that I have no control over the format of. If parameter 7 and 8 are missing which is possible they will be replaced by a space so I would end up with, field1 field2 field3 ...
dazedandconfused's user avatar
10 votes
2 answers
24k views

How do I escape a sub-directory name with an ampersand in it?

Running a kornshell and trying to traverse a directory tree. Want to cd to a sub-directory named as follows: -3ab_&_-3dc.img My question is HOW do I need to escape the ampersand in this name? I'...
RCinICT's user avatar
  • 101
148 votes
11 answers
55k views

What is the difference between $* and $@?

Consider the following code: foo () { echo $* } bar () { echo $@ } foo 1 2 3 4 bar 1 2 3 4 It outputs: 1 2 3 4 1 2 3 4 I am using Ksh88, but I am interested in other common ...
rahmu's user avatar
  • 20.1k
3 votes
2 answers
1k views

issues with GNU tail -f and combination of commands

$ tail -f /logs/filename.log | awk '!(/list)' I am able to run this command in GNU Linux flavour But when I written in a script it is not working. test.ksh: variable="/logs/filename.log | awk '!(/...
Manoj's user avatar
  • 31