Unix script rm behaiving differently in difference machine


 
Thread Tools Search this Thread
Top Forums UNIX for Advanced & Expert Users Unix script rm behaiving differently in difference machine
# 1  
Old 08-04-2009
Unix script rm behaiving differently in difference machine

Hi All

The below is the script, if i supply the script with the argument -f then it will delete the tmp file . We are having 3 unix system out of that two system are processing this file only one system is not processing and the error showin is below the script ..

can you please help me


#! /bin/ksh
if [ $# -eq 0 ]
then
Echo " Usage incorrect"
fi

if [ "$1" = "-f" ]
then
print "Home Dir : ${HOMEDIR} Unix User : ${UNXUSER}"
rm -f ~/clean_tmp_* 2> /dev/null
fi
.......


Home Dir : /pps Unix User : pct
/pps/clean_tmp_cmd[2]: +390: not found
^[&dE Error in file find/delete ^[&d@
{} not found
; not found
^[&dE Error in file find/delete ^[&d@
# 2  
Old 08-04-2009
The line:
Quote:
rm -f ~/clean_tmp_* 2> /dev/null
Will remove files called clean_tmp_* from the user running the scripts home directory, hence:
Quote:
/pps/clean_tmp_cmd
rather than the expected:
Code:
/pps/pct/clean_tmp_cmd

${HOME} is the standard variable for a user's home directory, don't know where ${HOMEDIR} comes from?

${LOGNAME} or ${USER} are the normal variables holding the username, don't know where ${UNXUSER} comes from?


If /pps is really the intended directory it would be interesting to see the output from:
Code:
ls -l /ppd/clean_tmp_*

because it looks like you "might" have some non-Unix compliant file names in there.

I'd also like to see what the user pct home directory is set to in /etc/passwd?
# 3  
Old 08-04-2009
Thank you ..

HOMEDIR=~
UNXUSER=`whoami`

This is where the HOMEDIR and UNXUSER comes from

ls -l clean_tmp_*
-rwxrwxrwx 1 pct pw 83 Aug 4 10:55 /ppd/clean_tmp_cmd
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

awk treating variables differently in UNIX-Linux

Hi, awk seem to be acting differently in Unix and Linux when it comes to formatting. This is making it difficult to migrate scripts. for example: UNIX: echo "123" |awk '{printf ("%05s\n" ,$1)}' 00123 echo "123" |awk '{printf ("%05d\n" ,$1)}' 00123 echo "S12" |awk '{printf ("%05s\n"... (9 Replies)
Discussion started by: wanderingmind16
9 Replies

2. Shell Programming and Scripting

Date time difference in UNIX shell script

There are 2 dates, Tue Oct 1 13:40:19 2013 Sun Sept 30 10:26:23 2013 I have multiple dates like the above one. How do I calculate the date time difference and display in another column in Shell script. Please help. (3 Replies)
Discussion started by: tanmoysays
3 Replies

3. Shell Programming and Scripting

How to transfer files from unix machine to local machine using shell script?

Hi All.. Am new to Unix!! Am creating a shell script in which a scenario is like i have transfer the output file from unix machine (Server) to local directory (Windows xp). And also i have to transfer the input file from the local directory to Unix machine (Server) Any help from you... (1 Reply)
Discussion started by: vidhyaS
1 Replies

4. Shell Programming and Scripting

Why is a variable behaving differently in ksh script.

Guys i have strange behaviour with command output being saved in a variable instead of a tmp file. 1. I suck command output into a variable Sample command output # cleanstats DRIVE INFO: ---------- Drv Type Mount Time Frequency Last Cleaned Comment *** ****... (1 Reply)
Discussion started by: lavascript
1 Replies

5. Shell Programming and Scripting

ftp from windows to unix using a perl script on unix machine

i need to ftp a file from windows to a unix machine by executing a sript(perl/shell/php) from that unix machine.i can also use HTML and javascript to build forms. (3 Replies)
Discussion started by: raksha.s
3 Replies

6. Shell Programming and Scripting

Need help in writing script for finding files in the unix machine?

I would like to find whether a file exists in the UNIX machine. That i can check using if ;then echo "exists" echo " `cat $file` " else echo "invalid file" fi. and i can find out using : find / -name "filename" . But it i have wanted to search in all directories. How to get... (3 Replies)
Discussion started by: rparsa001
3 Replies

7. Shell Programming and Scripting

Automatic FTP Script from windows to unix machine

Hi i need to FTP files from windows to unix(sun) machine using script. what are the scripts commands i need to use to transfer files Thanks (2 Replies)
Discussion started by: bmkreddy
2 Replies

8. UNIX for Advanced & Expert Users

Script behaving differently on two servers

All, I have a script that runs on 2 servers and there seems to be something wrong. It's producing different results on the 2 servers. Here is the script on server1 which is behaving correctly but on 2 behaving differently. 2nd server: I couldn't make out whats the error is?... (5 Replies)
Discussion started by: mhssatya
5 Replies

9. Shell Programming and Scripting

Script behaving differently in Crontab..

Hi, I wrote a script to stop a process,truncate its log files and re-start the process... We are using Progress Software in Unix ( Sun Sparc) When ever I start this progress program , it should kick off a C pgm in the background.. The script work perfectly fine when I run it from command... (4 Replies)
Discussion started by: newtoxinu
4 Replies

10. UNIX for Advanced & Expert Users

Script behaving differently in Crontab..

I posted this in Shell scripting... maybe I'll try it in this forum.. ***************** I wrote a script to stop a process,truncate its log files and re-start the process... We are using Progress Software in Unix ( Sun Sparc) When ever I start this progress program , it should kick off a... (1 Reply)
Discussion started by: newtoxinu
1 Replies
Login or Register to Ask a Question