ksh Questions
9
Solved
I am working on a KornShell (ksh) script running on a Solaris server that will send out an email when and error condition is met. I am sending the email via mailx.
Question: How do I set the "Fro...
6
I want to set the following variables to the same value in one single line
Example: export A=B=C=20
There is a syntax available in 'bash' but how can I accomplish the above in ksh ?
26
Solved
I have a script where I do not want it to call exit if it's being sourced.
I thought of checking if $0 == bash but this has problems if the script is sourced from another script, or if the user s...
2
Solved
I am attempting to work with an existing library of code but have encountered an issue. In short, I execute a shell script (let's call this one A) whose first act is to call another script (B). Scr...
7
Solved
To store the output of a command as a variable in sh/ksh/bash, you can do either
var=$(command)
or
var=`command`
What's the difference if any between the two methods?
7
Solved
I'm trying to validate input in ksh, and would like to know the easiest way to determine if a string is a valid number.
2
Solved
Ash, Dash or Bash, Zsh handles invalid empty parameters ${var:?} expansion error in a here-document differently.
Here is the experiment.sh code using genuine POSIX grammar:
#!/usr/bin/env sh
empty...
5
Solved
Inspired by this question:
What should an if statement do when the condition is a command substitution where the command produces no output?
NOTE: The example is if $(true); then ..., not if true...
6
Solved
Is there an equivalent of the bash pushd/popd build in commands for the KSH?
For those who don't know what pushd and popd in bash do, here is the description from the man page
pushd [-n] [dir]
...
17
Solved
I am writing a shell script to run under the KornShell (ksh) on AIX. I would like to use the mkdir command to create a directory. But the directory may already exist, in which case I do not want to...
8
Solved
I am looking for a way to list all the files in a directory excluding directories themselves, and the files in those sub-directories.
So if I have:
./test.log
./test2.log
./directory
./directory/...
8
Solved
I am looking for a way to list all the files in a directory excluding directories themselves, and the files in those sub-directories.
So if I have:
./test.log
./test2.log
./directory
./directory/...
8
Solved
I am looking for a way to list all the files in a directory excluding directories themselves, and the files in those sub-directories.
So if I have:
./test.log
./test2.log
./directory
./directory/...
6
Solved
4
Solved
I need to check if the variable has value of string which starts with specified substring.
In Python it would be something like this:
foo = 'abcdef'
if foo.startswith('abc'):
print 'Success'
W...
6
I have Linux centralize server – Linux 5.X.
In some cases on my Linux server the get_hosts.ksh script could be run from some other different hosts.
For example get_hosts.ksh could run on my Linux...
6
Solved
I have a file, file, with content like:
stringa 8.0.1.2 stringx
stringb 12.01.0.0 stringx
I have to get a substring from field 2 (the first two values with the dot).
I am currently doing cat file ...
3
Solved
How can I get the day of the year in shell?
date '+%V' will give me the week of the year, which is 15 for today; but I need to find the day of the year!
3
Solved
In ksh, how do I prompt a user to enter a value, and load that value into a variable within the script?
command line
echo Please enter your name:
within the script
$myName = ?
7
Solved
I am using AIX.
When I try to copy all the file in a folder to another folder with the following command:
cp ./00012524/*.PDF ./dummy01
The shell complains:
ksh: /usr/bin/cp: 0403-027 The para...
4
I use a modifies list command as alias (in KSH):
alias ltf='ls -lrt -d -1 $PWD/*'
So the command ltf displays something like this:
-rw-r--r-- 1 myuser mygroup 0 Apr 18 12:00 /usr/test.txt
-rw-r-...
4
Solved
8
I am using the following 2 commands to create a 0B file and set its extn to 644
touch filename.ext
chmod 777 filename.txt
My question is that whether there is any single command in unix (korn sh...
Labret asked 24/1, 2014 at 20:58
11
Solved
I'm sure there is a quick and easy way to calculate the sum of a column of values on Unix systems (using something like awk or xargs perhaps), but writing a shell script to parse the rows line by l...
10
Solved
1 Next >
© 2022 - 2024 — McMap. All rights reserved.