Questions tagged [ksh]

ksh, short for Korn Shell, is a Unix shell developed in the early 1980s.

89 questions
25
votes
8 answers

How to set default screen colours in putty/ssh

I use putty to ssh to linux box. By default I get black screen background with white foreground. To change colours, I go to change settings -> Window/colours and then I set background colours as white and foreground colours as black. This is more…
p2pnode
  • 1,357
18
votes
1 answer

overriding user defined functions with the same name as system commands

This function exists in one of my users' ~/.bashrc: function rm() { ls $* echo "rm?" read ans if [ "$ans" == 'y' ]; then /bin/rm $* fi } In my ksh script that users are required to run, I have…
acm
  • 283
6
votes
1 answer

What is the difference between "elif" and "else if" in shell scripting?

I am very new to shell scripting. When I look at some code, written for ksh (#!/bin/ksh) I see there is else if as well as elif used in one script. So, what is the difference between else if and elif in shell scripting?
6
votes
1 answer

Does "ulimit -Su" limit the number of user processes created in interactive login subshells and tmux sessions created therein?

A few months ago, I wrote a set of bash scripts utilizing tmux to create a simple IDE on an AIX 7.1 server. There is a bug in one of my scripts that will sometimes generate user processes very rapidly up to the limit set by ulimit. This happens very…
eeowaa
  • 165
5
votes
2 answers

How can I keep reading from a pipe even after the pipe is closed?

I've got a ksh script that calls: while read LINE do... The input has been redirected (not shown) so that it reads input from a pipe. The problem is that when the writer to the pipe closes, read returns false and exits the loop. I want it to keep…
davidparks21
  • 1,632
  • 1
  • 19
  • 29
5
votes
2 answers

Is ksh-syntax (Korn shell) compatible to bash?

I researched a lot of documentation online and tried to compare ksh to bash, as we want to refactor our scripts from ksh to bash. After a lot of researching I couldn't find any ksh syntax, which is not compatible with bash. I found some articles…
Eriko
  • 53
4
votes
3 answers

Split a string in ksh

I am looking for a quick/easy way to split a string in ksh. It has varied number delimiters (spaces) between each item. Example: value1 value2 value3 Any suggestions/advice?
4
votes
3 answers

Unix history not working

I'm using ksh on unix and connect through putty. My .sh_history stores all history commands but when I press up arrow nothing comes, please help me.
4
votes
1 answer

Create a file whose size in bytes is the percentage of free space on a disk

I needed a command-line method of creating a file whose size in bytes is the percentage of free space on a disk. I intend to run it via cron every five minutes, but first a shell script will do. The target platform is the BSD4.3 environment in…
pavium
  • 6,490
3
votes
1 answer

Delete old log files in AIX

I am trying write a script to delete old log files in \var\log\applog\nmon on my AIX system. We usually get alerts that the file system is almost full and at the moment delete old files by hand. So basically what i am looking for is a script that I…
3
votes
2 answers

Unix HP-UX ksh recursive find and replace

I am trying to do a recursive find and replace in HP-UX and am missing something. What I have at the moment: find . -name "*.java" | xargs sed 's/foo/bar/g' I know the problem is that it's not replacing the file inline. I believe on other OS's…
3
votes
3 answers

Fastest way to get creation and last modification times of a lot of files

Given a directory a sh pattern which yields a subset of files directly in this directory (like *.log) a sh pattern which can, given a filename, what is the fastest way (in ksh) to obtain for each file filtered in by the pattern: its name the…
3
votes
1 answer

ksh equivalent of perl $! error reason

Is there an equivalent of $! in ksh, which provides the error string ? $? stores the exit code only.
Abhinav
  • 2,040
3
votes
2 answers

Unix find not working with a wildcard in the path when ssh'ing

This command with a * in the find path works fine on the local server Svr1$ find /path/*/foo/ -name "*20160208" When I try this remotely from another server it doesn't work Svr2$ ssh Svr1 find '/path/*/foo/' -name "*20160208*" The error message…
LLJ
  • 35
2
votes
1 answer

Issues using scp to copy a file in Unix

I have a script where i need to get the cksum of the files in a directory from another host. I was able to do ssh to another host and create the file.txt. what i need to do now is to scp the file back to the host where i executed the script. find…
wow123
  • 23
1
2 3 4 5 6