LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 12-08-2003, 12:32 AM   #1
AquamaN
Member
 
Registered: Oct 2002
Location: Ohio, USA
Distribution: OS X 10.4.8, Ubuntu 6.10
Posts: 146

Rep: Reputation: 15
KSH script


Hey everyone, I'm trying to write a script that will be able to have paramaters like: -l and -p OR to be able to be given files and have it put them in a .junk folder.

So if I were to type:

junk -l

it would list the files in .junk folder

and if i were to type:

junk -p

it would delete all the files in .junk folder

and if i were to type:

junk one two three

it would take files "one" "two" and "three" and copy them in the .junk folder.

.junk is a hidden folder in the same folder as the junk script but I can't get it working. I know it is only like a few lines so could someone help me out? Thanks a lot!

-AquamaN
 
Old 12-08-2003, 05:38 AM   #2
jim mcnamara
Member
 
Registered: May 2002
Posts: 964

Rep: Reputation: 36
Post what you have so far.
 
Old 12-08-2003, 11:34 AM   #3
AquamaN
Member
 
Registered: Oct 2002
Location: Ohio, USA
Distribution: OS X 10.4.8, Ubuntu 6.10
Posts: 146

Original Poster
Rep: Reputation: 15
#!/usr/bin/ksh
#Script: junk
#Purpose: Junk is a replacement for the rm utility. Rather than removing files,
#it moves them into the subdirectory ".junk" in the local directory.
#The -l option lists the current contents of the ".junk" directory.
#The -p option deletes the files in .junk.

mkdir .junk

mv $1 $2 $3 .junk

if [[ -l ]]
then
ls .junk
else
:
fi

if [[ -p ]]
then
rm -r .junk
else
:
fi
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
gpg from ksh script Risc91 AIX 2 05-11-2005 10:45 AM
ksh math script SeT Programming 10 10-13-2004 08:06 AM
ksh directory comparison script SeT Programming 4 08-30-2004 11:57 AM
Can somebody help me with a ksh script? twentymil AIX 7 01-21-2004 09:55 AM
ksh script problem pldobs Programming 2 12-24-2003 11:38 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 02:55 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration