Sponsored Content
Full Discussion: house keeping script
Top Forums UNIX for Dummies Questions & Answers house keeping script Post 94186 by Rakesh Bhat on Wednesday 28th of December 2005 02:51:02 AM
Old 12-28-2005
house keeping script

Hi,

I am not aware whether any one has posted this early or not.

I am creating a house keeping script in which I give the user two options:

1. creating a zip file.
2. removing all files given by user.

Before taking any action I am asking user to
enter full path of file or files to be removed/zipped.
and File name [any char like file extn , file name , last date modified]

Here is my script:

#!/bin/sh

echo "HOUSE KEEPING"
echo "-------------"
echo "You want:"
echo "1. zip files."
echo "2. remove files."

read option

echo "Enter full File path:"
read PATH
echo "Enter File name:"
read FILE
echo "Enter Date:"
read DAYS


if [ option -eq 1 ]
then
#zip files
/usr/bin/jar -cvf $FILE.jar $PATH

#/usr/bin/find $PATH -type f -name "*$FILE*" -mtime +$DAYS > tmp.txt
fi

if [ option -eq 2 ]
then
#rm files

/usr/bin/find $PATH -type f -name "*$FILE*" -mtime +$DAYS -ls -exec rm -f {} \;

fi

Now the issue is when I select option 1 that is to zip file, I am getting
this error

./House_Keeping2: /usr/bin/jar: not found

I found the path is fine.

could plz help me making this working Smilie


thanks
 

6 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Help! Newbie in the house!!!

Ok i was reading a book (sad) and it said to type in 'ftp' in Start/Run. I did but I know no commands for it. Can someone help me??? I also typed in 'telnet' and I know no commands for that either so I would like help on that... Thanx ..The Nutcracker Elite.. (4 Replies)
Discussion started by: The Nutcracker
4 Replies

2. UNIX for Dummies Questions & Answers

Automatic House keeping in UNIX

I have a directory called 'test' which contains many junk files. I want to automate the clean-up task by removing all files which are older than one month. What would be the best option? (3 Replies)
Discussion started by: augustinep
3 Replies

3. AIX

Script Keeping Track of Itself

Hi All We have a WEB Based application running on the IBM AIX server. There is a EOD Job which runs a UNIX script containing EOD Jobs. Say If any job fails then we have to explicitly comment out the jobs which were successfully executed and then re run the same. Is there any was by which we... (7 Replies)
Discussion started by: Prashantckc
7 Replies

4. Shell Programming and Scripting

Mail cleanup from ksh script, keeping 50 most recent msgs

I found some posts describing how to completely clean out a mailbox in Unix/Linux. But I want to keep the 50 most recent messages. Any ideas out there? Thanks! (3 Replies)
Discussion started by: OPTIMUS_prime
3 Replies

5. Shell Programming and Scripting

In bash script, how to assign output of a command to a variable while keeping tabs?

Hi, wondering if it's been asked before but didn't find matches from google. Basically I have this line: myvar=$(echo -e "a\tb") Now somehow the '\t' from the echo output gets replaced with white space and then stored in $myvar. It creates a problem for me later to use tab as delimiter to do... (2 Replies)
Discussion started by: birddie
2 Replies

6. OS X (Apple)

Apple looking to switch to using in-house ARM chips for their HW.

Hi guys and gals... Intel reportedly expects Apple to start the Mac's transition to ARM next year - 9to5Mac (0 Replies)
Discussion started by: wisecracker
0 Replies
echo(1B)					     SunOS/BSD Compatibility Package Commands						  echo(1B)

NAME
echo - echo arguments to standard output SYNOPSIS
/usr/ucb/echo [-n] [argument] DESCRIPTION
echo writes its arguments, separated by BLANKs and terminated by a NEWLINE, to the standard output. echo is useful for producing diagnostics in command files and for sending known data into a pipe, and for displaying the contents of envi- ronment variables. For example, you can use echo to determine how many subdirectories below the root directory (/) is your current directory, as follows: o echo your current-working-directory's full pathname o pipe the output through tr to translate the path's embedded slash-characters into space-characters o pipe that output through wc -w for a count of the names in your path. example% /usr/bin/echo "echo $PWD | tr '/' ' ' | wc -w" See tr(1) and wc(1) for their functionality. The shells csh(1), ksh(1), and sh(1), each have an echo built-in command, which, by default, will have precedence, and will be invoked if the user calls echo without a full pathname. /usr/ucb/echo and csh's echo() have an -n option, but do not understand back-slashed escape characters. sh's echo(), ksh's echo(), and /usr/bin/echo, on the other hand, understand the black-slashed escape characters, and ksh's echo() also understands a as the audible bell character; however, these commands do not have an -n option. OPTIONS
-n Do not add the NEWLINE to the output. ATTRIBUTES
See attributes(5) for descriptions of the following attributes: +-----------------------------+-----------------------------+ | ATTRIBUTE TYPE | ATTRIBUTE VALUE | +-----------------------------+-----------------------------+ |Availability |SUNWscpu | +-----------------------------+-----------------------------+ SEE ALSO
csh(1), echo(1), ksh(1), sh(1), tr(1), wc(1), attributes(5) NOTES
The -n option is a transition aid for BSD applications, and may not be supported in future releases. SunOS 5.10 3 Aug 1994 echo(1B)
All times are GMT -4. The time now is 08:46 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy