[[ -z $1 ]] && set -- - # use stdin if no arguments
exec 3< $i # open file
exec 3<&0 # use stdin
while read -u3 -r line #read line
print -r -- "$line" # print line
exec 3<&- #close file
You can use Ksh read and print to accomplish the same thing 'rl' does without having to install another program that would need to be maintained. You can remove the 'print -r' line if you don't want to echo your input.
#!/usr/dt/bin/dtksh
print "Prompt: "
[[ -z $1 ]] && set -- -
for i
do...
I'm okay with that [smile]. Why not try something like I have below that eliminates all of the temp files that are being created. Untested.
who -u | cut -c 42-46,51-55 | sort -n -f | grep -E "5:|6:|4:|3:|2:" | cut -c 6-10 | exec 3<&0 | read -u3 -r line | kill -6 "$line"
I implemented this for a user who wanted all processes over 1 hour to be killed but not those processes that are under 1 hour. You will have to make any modifications to suit your own needs.
#!/bin/ksh
Ctime=$(date +%T)
__chk_time() {
CtimeH=$(echo $Ctime | awk -F: '{ print $1 }')...
Solaris:
unix2dos, dos2unix
AIX:
dosread, doswrite
tr -d '\r'
sed 's/^M//g' file > newfile #where ^M is ctrl-v/ctrl-m
ftp would also work with the binary and ascii subcommands.
Best I can come up with as of now. The user will have to press the "=" key and it will fill in /foo/bar/ and they can edit it.
#!/usr/dt/bin/dtksh
function vi_tab
{
if [[ ${.sh.edmode} != " " && ${.sh.edchar} == "=" ]] then
.sh.edchar="/foo/bar/"
fi
}
print "Prompt: \c"...
If anyone has an installed SP2 complex I have created a script to check for certain conditions. It uses 3 files as shown below. I hope someone finds it useful.
psspchk.sh
#!/usr/dt/bin/dtksh
__GetDisks() {
x=$(grep hdisk /tmp/work.txt)
if [[ $? -eq 0 ]]
then
R=${x#*=}; L=${R%%;*}...
Okay. Now that I reread it, are you wanting it to prompt:
Please update the following path:
and below that it would display the path:
/foo/bar/
??
Which means that you really don't want to use 'read' because you want to edit (/foo/bar/) and then enter that to be used for the rest of the script?
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.