I'm trying to do validation of a date entered as numbers only. (e.g. 09042009 as 09/04/2009)
The code now just checks the length of the date.
How would I validate not only length of the date entry but also that it is a real date? What would be the syntax for combining tests and regular expression?
Code as it exists now:
echo "Plea...
The Korn shell used to have a very useful option to cd for traversing similar directory structures e.g. given the following directorys
/home/sweet/dev/projects/trunk/projecta/app/models
/home/andy/dev/projects/trunk/projecta/app/models
Then if you were in the /home/sweet.... directory then you could change to the equivalent director...
I've seen this question answered in other languages but not the Korn Shell. I need to prevent a script from being run on the last business day of the month (we can assume M-F are business days, ignore holidays).
...
I've been Googling and Overflowing for a bit and couldn't find anything usable.
I need a script that monitors a public folder and triggers on new file creation and then moves the files to a private location.
I have a samba shared folder /exam/ple/ on unix mapped to X:\ on windows. On certain actions, txt files are written to the share...
Hello members,
I'm working on the Solaris environment and the DB i'm using is Oracle 10g.
Skeleton of what I'm attempting;
Write a ksh script to perform the following. I have no idea how to
include my sql query within a shell script and loop through the
statements. Have therefore given a jist of what I'm attempting, below.
Copy file...
Hi,
In bourne-compatible shells, the { list; } syntax causes the complete list of commands to be read by the shell before executing it, without opening a new shell. Is there anything similar for the csh?
Thanks.
...
Hello.
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 tilde ~)
I found this:
bind '^[[3'=prefix-2
bind '^[[3~'=delete-char-forward
bind '^[[1'=prefix-2
bind '^[[1~'=beginning-of-line
bind '^[[4'=prefix-2
bind '^[[4~'=end-of-line
...
We're using named pipes with Sybase bcp so that we can compress output on-the-fly.
This is a paraphrase of the error handling idiom, some error checking in the non-bcp parts of the script has been removed to shorten the example.
while :
do
{
rm -f $fifo
mkfifo $fifo
cat $fifo &
CatPid=$!
b...
i have unix shell script which is need to be run like below
test_sh XYZ=KLMN
the content of the script is
#!/bin/ksh
echo $XYZ
for using the value of XYZ i have do set -k before i run the script.
is there a way where i can do this without doint set -k before running the script. or is there something that i can do in the script...
I am a novice in unix.
i am facing a problem in viewing big log files in unix using Vi tool.
could you please suggest the best tool for fast viewing of big files on unix.
Request you to post your own ways of viewing the big files on unix.
appreciate your help:)
...
How can I iterate through a simple range of ints using a for loop in ksh?
For example, my script currently does this...
for i in 1 2 3 4 5 6 7
do
#stuff
done
...but I'd like to extend the range way above 7. Is there a better syntax?
Thanks!
...
I am using some macro in my source file (*.c ) .
Is there any way during compilation or from the library that I can identify the exact header file from which this particular macro is getting resolved ?
The issue is we are using a macro #defined to 10 in some header file, but the value being received in the code is 4 . So instead of g...
I have GIT running on a Solaris server.
From a windows machine I installed cygwin to try to clone a repository hosted on the server.
I do the following:
$ git clone username@server:project.git
ksh: git-upload-pack: not found
So I try
$ ssh username@server echo \$PATH
/usr/bin
It seems like git is not in /usr/bin/ but in /usr/lo...
Hi all,
I am new to unix and am using sun solaris (v10 i think) . I have my shell set as korn shell . i am wondering how to make the arrow keys and delete key work in the command line . I have done set -o emacs and the backspace works , but not the arrow keys and the delete keys . Also is it possible to set the up and down arrow key to...
I've written a simple KShell script to kick off a background task
#/bin/ksh
#startMonitoring
./detectFile /usr/local/data/testFile > fileHistory &
I run it with the following command
startMonitoring
When I run jobs I get no results, but the command is running and shows up in ps:
512232 pts/0 0:34 /bin/ksh ./detectFile /usr/...
Hello,
i am testing with the shell script below:
#!/bin/ksh -x
instance=`echo $1 | cut -d= -f2`
if [ $instance == "ALL" ]
then
echo "strings matched \n"
fi
It's giving this error in the if condition:
: ==: unknown test operator
is == really not the correct syntax to use?
I am running on the command line as below
test_lsn_2 INST...
What is the meaning for $! in shell or shell scripting? I am trying to understand a script which has the something like the following.
local@usr> a=1
local@usr> echo $a
1
local@usr> echo $!a
a
It is printing the variable back. Is it all for that? What are the other $x options we have? Few I know are $$, $*, $?. If anyone can point me ...
How do I format a date in a korn shell script to DD-MON-YYYY?
I have tried the following:
date '+%d-%h-%Y'
It returns 04-Nov-2009 I need for the Nov to be NOV (all caps). Can this be done with the date utility?
...
I came across a working ksh script [interactive] today, where I saw the below statement.
printf "Enter the release no. : " >&5
I wonder the use of ">&5" when the author could have as well use nothing or say ">&1".
Can someone shed some light on this point?
Thanks in advance
--
Benil
...
I'm attempting to write a Korn Shell function that uses printf to pad a string to a certain width.
Examples:
Call
padSpaces Hello 10
Output
'Hello '
I currently have:
padSpaces(){
WIDTH=$2
FORMAT="%-${WIDTH}.${WIDTH}s"
printf $FORMAT $1
}
Edit: This seems to be working, in and of itself, but when I ...