Tagged Questions
2
votes
0answers
28 views
KSH styling text based menu using STDERR
Is it possible to format the STDERR in order to have a better looking menu using the select command?
I have a simple select
select oChoice in $(<tempMenu.menu) ; do
case "$oChoice" in
...
18
votes
2answers
405 views
Why escape trivial characters in shell script?
I just opened a legacy shell script (written in old ksh88 on Solaris) and found the following repeated all throughout the code:
[ -f $myfile ] && \rm -f $myfile
The escaping backslash ...
1
vote
1answer
137 views
How to get subshell's PID in Korn Shell (equivalent of $BASHPID)
In bash you have this handy variable: $BASHPID wich always returns the currently running subshell's PID. How can I get a subshell's PID in ksh? For example see the code below:
#!/usr/bin/ksh93
echo ...
2
votes
2answers
118 views
Creating a variable with sed in ksh
I'm using Ksh88 on a Solaris 10 machine.
If I do the following:
foo="one two three"
for i in $foo; do
echo $i;
done
The script executes as expected:
$ ./script.ksh
one
two
three
However if ...
3
votes
3answers
186 views
What are the significant differences between different shells? [closed]
Possible Duplicate:
What are the fundamental differences between the mainstream *NIX shells?
If I write a shell script in bash, will it run in ksh as well?
if not, what are the ...
0
votes
3answers
70 views
ksh cannot cp from location with space in it?
I am trying to do the following in ksh but keep getting cannot stat message for the cp command:
JMX_ROOT=/bfs-build/build-info/mep_mainline-Linux.latest/core/mainline/automation
...
1
vote
1answer
198 views
Concatenate multiple strings with spaces in them?
I am trying to do the following in ksh shell:
JMX_ROOT=/bfs-build/build-info/mep_mainline-Linux.latest/core/mainline/automation
SMOKE_JMX_LOCATION="$JMX_ROOT/\"Smoke Set\"/*.txt $JMX_ROOT/\"Smoke ...
2
votes
4answers
322 views
Match regex in ksh
I am looking to do something like this in KSH:
if (( $var = (foo|bar)[0-9]*$ )); then
print "variable matched regex"
fi
Is it possible at all?
For the record I'm using Ksh Version M-11/16/88i ...
3
votes
4answers
346 views
Is there a way to sum up the size of files listed?
This is the command I am using to list some files:
find . -name \*.extract.sys -size +1000000c -exec ls -lrt {} \;
-rw-r--r-- 1 qa1wrk15 test 1265190 Sep 29 01:14 ...
3
votes
2answers
210 views
Replace all occurrences of a character in a variable using korn script
Part of the Korn script I am writing requires that I replace all occurrences of the ' character with two occurrences (''). I am trying to log some SQL that I am generating in this script to a column ...
2
votes
3answers
192 views
regexp in ksh for extensions tgz, tar.tgz
I'm trying to get a regexp (in ksh) to identify files with only the following extensions : tgz, tar.gz, TGZ and TAR.GZ. I tried several ones but cant get it to work. I'm using this regexp to select ...
2
votes
2answers
144 views
Create a new file by removing the new line character at the end of file
I have a flat file which contains the following data records between H: and T:.
H:20050427 HEADER RECORD
0000000 00000 000000000 123456 00 654321 DATARECORD
0000000 00000 000000000 123456 00 654321 ...
3
votes
2answers
394 views
How to catch optioned and non optioned arguments correctly?
I want to write a shell script which will take some arguments with some options and print that arguments. Suppose the name of that script is abc.ksh. Usage of that script is -
./abc.ksh -[a ...
3
votes
2answers
415 views
Reason for ksh obsoleting -eq
The latest version of ksh obsoletes using -eq within [[ ]] blocks, prefering (( )) instead. Why is this? I can't find any documentation on the advantages of (( )) over [[ ]] anywhere, and I find that ...