Ksh is the executable name for the Korn shell developed by David Korn at AT&T Laboratories in the early 1980s. It is commonly used in Solaris and is favored for its ability to use Emacs and Vi shortcuts at the command line.

learn more… | top users | synonyms

0
votes
2answers
312 views

linux + how to identify if file is pointed by link/s

I create new file called - 192.9.200.1 touch 192.9.200.1 then I create new link that will be pointed to 192.9.200.1 file ln -s 192.9.200.1 file so finally I get: ls -ltr /tmp ...
0
votes
2answers
784 views

sed + how to remove the last string after specific character

how to remove the last string after "." character include the "." character itself implementation can be with sed under Linux/Solaris operation system example of IP address before change ...
1
vote
2answers
206 views

rm + how to remove file with special Characters [duplicate]

I have this file in my linux machine: ----------9976723563nneh4_-----192.9.200.4 I try to delete this file but I cant as all see here: what need to add to rm in order to remove this file ? rm ...
0
votes
2answers
129 views

linux + delete duplicate IP's from file

what the best way to remove duplicate IP's from file I use the command: sort file | uniq but I am not sure if this is the best way , maybe I missed something? remark: my file contain two ...
0
votes
1answer
239 views

linux + exit status from perl one liner code

I use perl one liner in my ksh scripts some times its necessary to get exit status from the perl one liner in order to very if perl one liner succeeded or not for example I need to verify if the ...
1
vote
2answers
171 views

re-create new link and remove the old link on one command

according to ln manual page: man ln -f, --force remove existing destination files so as I understand if I want to re-create new link to some destination directory/file I can ...
2
votes
1answer
275 views

AIX 7.1 .kshrc ignored

I've created .kshrc file in my home directory, but all my custom settings are ignored. ENV variable is not set. How can I force ksh to read .kshrc? Here is my .kshrc: set -o emacs export ...
-1
votes
2answers
518 views

linux/solaris insert date & time at the beginning of each line in file

I want to add date & time at the begging of each line in some file I used sed in order to add the date & time before each line in file please advice what I need to update in my sed in order ...
-2
votes
1answer
122 views

case + how to implement equal or less or greater in case syntax

my target is to verify the range of number with (only with - case + esac ) , and print the range so for example if number is between 0-80 , case will print >=0<=80 or if range is ...
-3
votes
2answers
82 views

perl one liners + add empty line after the last line [closed]

please advice what need to change in the perl syntax in order to add new empty line after the last line? example IP_INFO=12.23.2.1 echo IP= | perl -pe "s/$/$IP_INFO/" 1>>file . ...
0
votes
1answer
280 views

grep to IP address when IP address in parameter

I need to grep to IP address ( as the following example ) , I use ksh script , # ifconfig -a | /usr/xpg4/bin/grep "100\.106\.2\.120 " inet 100.106.2.120 netmask ffffff00 broadcast ...
1
vote
2answers
748 views

how to see process status with full details

I run the script - my_script.ksh as process with 5 long arguments on my solaris/linux machine ( example 1 ) , Later I verify the process by ps -ef | grep my_script.ksh I don't understand ...
13
votes
4answers
35k views

How do I sleep for a millisecond in bash or ksh

sleep is a very popular command and we can start sleep from 1 second: # wait one second please sleep 1 but what the alternative if I need to wait only 0.1 second or between 0.1 to 1 second ? ...
-1
votes
2answers
211 views

shell: create Shortcut command (alias or function) for working with IP address as arguments

I am not sure if I performed the following illegal or true but what I need is - to create set of ready commands so if I need to use , for example to match IP address with 4 octet I can use the ...
-2
votes
1answer
124 views

linux + count how many digits in IP address [closed]

I write the following syntax (exist in my ksh script) in order to find how many digits I have in IP address IP_address=127.1.1.1 echo $IP_address | sed s'/\./ /g' | wc | awk '{print $2}' 4 . ...
0
votes
3answers
218 views

grep + Regular Expressions to match uniq number

My target is to verify if $FILE is a backup file ( backup file ended with xxxx.xx.xx.xx number Example of backup files ls /etc/VRTSvcs/conf/config main.cf.17Dec2012.09.10.14 ...
1
vote
1answer
135 views

Logging commands executed by remote shell scripts

I've noticed that when running a script that connects to a number of our servers (to essentially run batch commands) that the commands aren't logged in the user's .sh_history or .bash_history files. ...
-3
votes
2answers
324 views

linux + solaris + delete all characters in file except numbers and dot char [closed]

please advice how to delete all characters in file except numbers and "." Should be implemented by sed or awk or perl ( one line ) or any other idea , so I will add the syntax in my ksh script ...
2
votes
3answers
175 views

linux + match only VALID IP from text file into other file

please advice how to match only the valid IPs ( 255.255.255.255 ) from the file.txt and insert only the valid IP into VALID_IP.txt file ( see VALID_IP.txt for example ) the solution should be ...
1
vote
2answers
124 views

ksh + match and verify two strings in single line

how to match the words linux1a and linux1b from single line ? ( should be performed by ksh ) list="solaris1a Auto global linux1a linux1b" echo $list | .... ? my target is to find ...
0
votes
1answer
407 views

expect script + how to perform case in expect script

the following expect script target is to print the hostname name from linux/solaris machine and according to hostname results expect script will run linux.ksh or solaris.ksh script ...
0
votes
1answer
342 views

expect script + write “if” in expect script

please advice what's wrong with my exepct syntax ( I run expect in ksh script on Solaris 10 machine ) I want to verify if OS is linux so if it true the expect check if prompt is "#" or ">" and ...
0
votes
1answer
58 views

Weird behaviour with ksh?

So I found something somewhat interesting in ksh. I found that if the last character is \, then immediately backspace, the charcter becomes recplaced with ^H. I am then able to press backspace again ...
-1
votes
1answer
366 views

linux + print message on the screen after login to linux machine

I have linux machine red-hat 5.1 I want to write ksh/bash script that perform the following Each time that someone login to the linux machine then he will get the following message on the screen ...
1
vote
0answers
255 views

Automate an interactive command which use /dev/tty

well pretty much it's in the title. I've a interactive command. This one ask for a password through /dev/tty. I use this command within a shell script. So the command should read the information ...
1
vote
3answers
2k views

Delete key not working when PuTTYed in to AIX box using Korn shell

I manage an AIX box at work using PuTTY. I'm using ksh in vi-mode. When I press the Delete key (not backspace) the case of following characters is toggled instead of the character under the cursor ...
-1
votes
3answers
198 views

linux + generate new file with specific structure from text file what the best option

in my Linux machine I have the file orig-file.txt this file include now 4 fields but they could be less or more ( this file generate by other application ) I need advice - what the best option to ...
11
votes
7answers
2k views

executable in path, findable by which, yet cannot execute without fully qualifying path?

I've got a bizarre seeming shell issue, with a command in the $PATH that the shell (ksh, running on Linux) appears to cowardly refuse to invoke. Without fully qualifying the command, I get: # ...
4
votes
2answers
1k views

expect + how to identify if expect break because time out?

The target of the following simple expect script is to get the hostname name on the remote machine Sometimes expect script fail to perform ssh to $IP_ADDRESS ( because remote machine not active , etc ...
1
vote
2answers
348 views

Script SCP without certificates or expect

I need to script SCP and I need to be able to do this by passing in the password in plain text. I am absolutely aware of the horrible design pattern that I am asking for. I cannot use certificates for ...
3
votes
1answer
176 views

shell script (KSH) + set file to param & perform test between param and string

in my linux machine red-hat 5.1 - in ppp file - I have only the signature.pl string !!! remark - third application write the signature.pl string in to ppp file I set ppp file in $a param And ...
0
votes
1answer
204 views

Lock down Solaris Shell Changing for normal users

I have a few dozen Solaris(5.10) boxes. By default, they are using ksh as the shell. Only a few users have sudo privileges. The rest do not. I don't want my regular users changing to another shell. ...
0
votes
3answers
83 views

shell script + match MAJOR and CRITICAL strings from log file

I need to match lines that have MAJOR and CRITICAL strings that comes after the word ERROR:< any integer number > please advice how to do that with one awk or sed command? more HW_Log.txt ...
0
votes
1answer
171 views

ksh + print the last value from parameter ( as $_ in perl)

I need advice - how to print the same last value in ksh scripts without to print param argument for example in perl last value is $_ , but we not have this option in ksh script example - of ksh ...
0
votes
1answer
527 views

svn: Too many arguments to import command

Having a problem with the --message flag to the svn import command. On some servers it works, but on others it gets confused if the message contains spaces, even if you single or double quote the ...
0
votes
1answer
300 views

linux + run script on other shell because script stuck - not return to linux prompt

In my Linux machine I have binary script (called transferNames.bin ) The problem is that when I run transferNames.bin with & script stuck and not returns to Linux prompt “#”, even if I wait 1 day ...
2
votes
4answers
3k views

linux + create simple watch dog process in shell script

I need to create watch dog process (will run in linux version 5.x) that look all time on /etc/cluster.cf file And if the process matches the string: machineA_is_active in the cluster.cf file Then ...
1
vote
2answers
192 views

Solaris 8 - directories gone missing; is this housecleaning script the culprit?

Our outsourced IT service provider runs the following script via cron to clean up Oracle core and trace files. It clearly is not a well-written script, but my question for the Serverfault crowd is ...
1
vote
1answer
113 views

shell script + add inside the script PATH for standard output

Usually if we want to redirect script output to file we simply do /etc/create_connection.sh > file.debug.txt Or /etc/create_connection.sh | tee –a file.debug.txt But What I want is ...
0
votes
1answer
679 views

What version of ksh ships with AIX 5.3?

I'm writing a Korn shell script for a client, who will use it on AIX 5.3. For testing, I'm using version 93u-1 Debian Wheezy. Is this the same version as the one I'll find on AIX?
2
votes
2answers
110 views

What do the 2 leading underscores indicate in these alias lines for .kshrc?

I am configuring ksh88 on AIX 5.3L and came across a few lines that are supposed to enable the arrow keys for command history navigation. alias __A=$(print -n "\020") alias __B=$(print -n "\016") ...
3
votes
2answers
1k views

Preventing bash (and ksh) history alteration in Linux

From the looks of things, fixing ksh to make history alteration impossible is fairly easy. I've seen all the recommendations to make HIST* environment variables read-only, and the use of chattr to ...
1
vote
2answers
66 views

ksh93 esc-esc complation

Does anyone know how to set esc-esc completion? I've installed ksh93 from ports on FreeBSD. set -o vi NOR set -o viraw have any effect Thanks
2
votes
2answers
639 views

ctrl-v key on AIX

I'm new to AIX and I miss some tricks that work well on other *nix flavors. I need a CTRL sequence in a ksh scripts, like ^[ (CTRL-[) and to do that I'm habit to use the ctrl-v[ , but here it doesn't ...
2
votes
3answers
121 views

Will uploading modified version of a KSH script affect processes that are currently running the script?

Let say I have a KSH script my_script.ksh that performs complex operations including but not limited to invoking SQLPLUS to manipulate large number (millions) of records in an Oracle database. The ...
5
votes
6answers
2k views

how do I make solaris shell more familiar for a linux user? [closed]

I've been a linux user for years. Very used to the bash shell, used to linux shell key mappings that come with most mainstream distros. I'm also a happy vim user in linux & love my arrow keys. ...
0
votes
5answers
2k views

Solaris: determine if login shell (su -) or not

What's the best way to determine from a ksh script if the current shell is a login shell (su - user) or not (su user). I'm toying with: user=$(/usr/xpg4/bin/id -un) login=$(grep $HOME /etc/passwd | ...
4
votes
2answers
505 views

home, end, delete, pageup, pagedown with ksh

I want to use home, end, delete, pageup, pagedown with ksh. My TERM is xterm-color. These keys works fine with tcsh and zsh, but not with ksh (print a tilda ~) I found this: bind '^[[3'=prefix-2 ...
1
vote
3answers
2k views

Providing command line arguments for an executable through a shell script

Suppose I have an executable xyz that takes a variable number of command-line arguments, and a wrapper Korn shell script xyz.ksh. Is there an easy way to pass all of the shell script arguments as-is ...
16
votes
4answers
15k views

How to pipe stderr without piping stdout

How do I pipe the standard error stream without piping the standard out stream? I know this command works, but it also writes the standard out. Command 2>&1 | tee -a $LOG How do I get ...