12-15-2005
Actually the issue is not that find command is not working. I am able to run the find command successfully on the command line but not in the script. When I use it in the script, it gives me the following error message:
find: paths must precede expression
Usage: find [path...] [expression]
Also, the if statement doesnot work if I find multiple files with the following characteristics:
abc1.txt.$DATE2*
How can i successfully look for files "abc.txt.$DATE2* and delete them. On the command line I can use the find command and delete these files but the same command doesn't work in the script.
-George
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
I understand this question probably poses some child like stupidity, but I can't get this if statement to work for love or money.
#!/bin/ksh
echo "Input either 1 or 2"
read Num
if ; then
echo "Message 1"
if ; then
echo "Message 2"
else
echo "false"
fi
$ ksh decisions
Input either 1... (6 Replies)
Discussion started by: Hazmeister
6 Replies
2. UNIX for Dummies Questions & Answers
im trying to write an until statement which dont go onto the next stage until the user inputs a certain phrase. It is then stored in an array. Ive come up with this code so far but its not working and i dont know why.
read in1
until
do
echo "Incorrect, try again"
... (2 Replies)
Discussion started by: strasner
2 Replies
3. Shell Programming and Scripting
Pls this is emergency.I have written a script which is taking input from another script. and the contents of my second script are acting as functions to my main script.Now the problem is that in one of the functions i want the script ececution to stop and start when user enters any character r... (2 Replies)
Discussion started by: sumitdua
2 Replies
4. Shell Programming and Scripting
I have a script consisting of certain functions whose input is a file at same location. In that file i have written the name of anothe file at same location. The third file contains a word which act as a function in the first script.Let me give an example
i have a scrip file say 1.sh in which i am... (7 Replies)
Discussion started by: sumitdua
7 Replies
5. UNIX for Dummies Questions & Answers
Hello all,
I am trying to write a post-commit hook script using bash script. What I am trying to do here is:
Developers check in their files to a branch. I check the repository and based on the commit I email QA people.
QA verifies and moves the files to a prod branch and email is sent... (1 Reply)
Discussion started by: kminkeller
1 Replies
6. Shell Programming and Scripting
Hi.
With the help of this group I have created a shell script to find the factorial of a number.
OK. Then I got wild.;) I tried to put in a check to make sure the entry is a number.
read num
If )) then
echo "This is not a valid number. Try again."
fi
while (( $var <= $num)) more... (5 Replies)
Discussion started by: Ccccc
5 Replies
7. Shell Programming and Scripting
Hi .I am trying to check the first arguments =-s and the third =-d,but it doesnt work ,any idea why
It gives me if: Missing file name
Thanks
#case -s and files
if( $1 == "-s" && $3 != "-d" ) then
echo "case s"
endif (1 Reply)
Discussion started by: lio123
1 Replies
8. Shell Programming and Scripting
#! /bin/ksh
rm -f ./xyz file --- this line is working
// Below any if stmt is not working.
if
then
echo " blah blah "
fi
or I replaced above if with
if
then
echo "dir exists"
fi
This is also not working.
I am new to KSH. So can someone help why if stmt is not... (31 Replies)
Discussion started by: saggy9583
31 Replies
9. Shell Programming and Scripting
case "$freq" in
" Hz") low=250; high=550;;
"8 Hz") low=250; high=1000;;
" Hz") low=400; high=1000;;
"63 Hz") low=550; high=1000;;
" Hz") low=400; high=550;;
... (2 Replies)
Discussion started by: Michael Stora
2 Replies
10. Shell Programming and Scripting
hello guys,
i am having the below piece of code
error
()
{
echo"Press y /n"
read ans
case $ans in
y) main;;
n) exit
esac
}
In the abve code, read statement is not working i.e not waiting for user to enter input.
,i tested exit status its 1.
could anyone help me to do this
... (11 Replies)
Discussion started by: mohanalakshmi
11 Replies
SETUID(1) General Commands Manual SETUID(1)
NAME
setuid - run a command with a different uid.
SYNOPSIS
setuid username|uid command [ args ]
DESCRIPTION
Setuid changes user id, then executes the specified command. Unlike some versions of su(1), this program doesn't ever ask for a password
when executed with effective uid=root. This program doesn't change the environment; it only changes the uid and then uses execvp() to find
the command in the path, and execute it. (If the command is a script, execvp() passes the command name to /bin/sh for processing.)
For example,
setuid some_user $SHELL
can be used to start a shell running as another user.
Setuid is useful inside scripts that are being run by a setuid-root user -- such as a script invoked with super, so that the script can
execute some commands using the uid of the original user, instead of root. This allows unsafe commands (such as editors and pagers) to be
used in a non-root mode inside a super script. For example, an operator with permission to modify a certain protected_file could use a
super command that simply does:
cp protected_file temp_file
setuid $ORIG_USER ${EDITOR:-/bin/vi} temp_file
cp temp_file protected_file
(Note: don't use this example directly. If the temp_file can somehow be replaced by another user, as might be the case if it's kept in a
temporary directory, there will be a race condition in the time between editing the temporary file and copying it back to the protected
file.)
AUTHOR
Will Deich
local SETUID(1)