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...
Dyne asked 18/8, 2009 at 22:43

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 ?
Nimitz asked 9/10, 2015 at 6:12

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...
Guarantor asked 21/4, 2010 at 13:28

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...
Lustring asked 18/6, 2014 at 16:29

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?
Abrams asked 16/1, 2011 at 22:34

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.
Dressler asked 9/2, 2012 at 18:51

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...
Atombomb asked 24/3, 2023 at 16:18

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...
Devil asked 22/1, 2012 at 23:59

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] ...
Written asked 12/6, 2009 at 1:34

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...
Phobia asked 27/4, 2009 at 14:47

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/...
Dejadeject asked 19/8, 2009 at 15:16

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/...
Busby asked 19/8, 2009 at 15:16

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/...
Bearce asked 19/8, 2009 at 15:16

6

Solved

I have a string that i am want to remove punctuation from. I started with sed 's/[[:punct:]]/ /g' But i had problems on HP-UX not liking that all the time, and some times i would get a 0 and ...
Sisneros asked 30/8, 2012 at 19:20

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...
Obscene asked 2/11, 2010 at 17:27

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...
Varicocele asked 24/11, 2014 at 9:13

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 ...
Aforethought asked 18/11, 2021 at 14:38

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!
Gayelord asked 11/4, 2012 at 19:17

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 = ?
Boling asked 23/7, 2011 at 19:40

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...
Stent asked 5/5, 2011 at 3:31

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-...
Cracow asked 18/4, 2011 at 7:24

4

Solved

I always believed that a sub-shell was not a child process, but another shell environment in the same process. I use a basic set of built-ins: (echo "Hello";read) On another terminal: ps -t pt...
Alkmaar asked 4/2, 2013 at 12:31

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...
Effective asked 17/11, 2008 at 15:5

10

Solved

Consider a ASCII text file (lets say it contains code of a non-shell scripting language): Text_File.msh: spool on to '$LOG_FILE_PATH/logfile.log'; login 'username' 'password'; .... Now if this ...
Libeler asked 21/1, 2013 at 8:4

© 2022 - 2024 — McMap. All rights reserved.