Problems with one of my Shells in VI


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers Problems with one of my Shells in VI
# 1  
Old 04-28-2009
Problems with one of my Shells in VI

This is what I have the File name is called collect
and I made it to search for a file named collection if its not there it makes it i'm just having toruble making it start** I made it in VI

Code:
 
# Program designed to copy files to a
# collection folder.

dir=$1
# output the errors to another dimension!!
ls "$dir" > /dev/null 2> /dev/null
 
# check to see if there is one command line argument
if [ $# -eq 1 ]
then    # check to see if file exists
   if [ ! -f $1 ]
   then
      echo "This file does not exist."
      exit 2
   else      # check to see if directory exists
      if [ ! -d $HOME/collection ]
      then
         mkdir collection
         cp "$dir" collection
      else
      # mkdir collection
         cp "$dir" collection
      fi
   fi
else    
   # output errors to another dimension!!
   ls "$dir" > /dev/null 2> /dev/null
   # error message stating that a command line argument is needed
   echo "error!! I need a filename"
   exit 1
fi


Last edited by vbe; 04-28-2009 at 01:30 PM.. Reason: added code tag (reformat for reading...)
# 2  
Old 04-28-2009
Is it an execute permission issue?
If so, did you do a "chmod u+x collect" or chmod 755 on the filename?
# 3  
Old 04-28-2009
I did fix that part

now I need help making sure this shell works prefectly
# 4  
Old 04-29-2009
Never made i got it fixed
 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

2 shells in one file

In the below code I am trying to combine two shell into one, but not sure if Im doing it right. Basically, there are 3 steps: Step 1: the file conversion (which is underlined and asks the user if the file needs to be converted, if "y", then it runs the perl script if "n" then it skips to line... (4 Replies)
Discussion started by: cmccabe
4 Replies

2. UNIX for Dummies Questions & Answers

Please what are shells?

I mean like this: http://shells.red-pill.eu/ Can anyone explain how this works? I hope my post is not spam. I think its related to linux. Thank you (1 Reply)
Discussion started by: postcd
1 Replies

3. UNIX for Dummies Questions & Answers

Shells

Lets say my default shell is bash and then i load up csh and then ksh. How would i exit csh without exiting ksh? so basically i gone from bash > csh > ksh and i wish to close csh (2 Replies)
Discussion started by: Bill Thompson
2 Replies

4. UNIX for Dummies Questions & Answers

shells and scripts

So in UNIX, I understand that there are several different shells you can be in: C, Bourne, Bourne Again, Korn, etc. I also know that you can write scripts for the shells, by assigning it by #!/bin/csh, or sh, etc. If I am working in the csh, do I have to write the script for the csh? Or can it... (1 Reply)
Discussion started by: bjstaff
1 Replies

5. Shell Programming and Scripting

Switching between shells

I don't know why, but it just isn't working how I want it to work. You might want to run it to see what I mean. Or you might be a genius (or just really good at unix) and know just by looking at it what the problem is. Have fun trying to figure this one out.:wall: (11 Replies)
Discussion started by: nowruzr
11 Replies

6. UNIX for Advanced & Expert Users

why we have different shells?

Can you pls. tell me, why we have different shells in UNIX OS ( Eg. SunOs) and also I would like to know what is the specific difference b/w SVR and BSD ? Thanks. (2 Replies)
Discussion started by: shahnazurs
2 Replies

7. Shell Programming and Scripting

control sub-shells

Hi all, New to shell scripting, I would like to know if it is possible to pass commands to a shell, which has been launched by a parent shell. Example: #!/bin/ksh # # Launch and command shells # . mySecondShell.ksh #this launches a sub-shell #now is something like this possible?... (7 Replies)
Discussion started by: MarkZWEERS
7 Replies

8. Shell Programming and Scripting

Launching Several Shells....

Hi, I need to create a shell that launches several shells named for example svspush (that does nothing but wait) and record their pid in a file. Any inputs please. Thanks, Marconi (1 Reply)
Discussion started by: marconi
1 Replies

9. UNIX for Advanced & Expert Users

Shells

I have came across the definitions of these shells korn bourne c etc .. but honestly till now i din't get the exact difference between these threes , the advantages ..... can anyone pinpoint me where it actually lies ..... don;t include me answers like aliasing in c is posible and not in bourne ..... (3 Replies)
Discussion started by: dino_leix
3 Replies

10. Shell Programming and Scripting

Different type of Shells

Hello every body iam new to UNIX and shell scripting and i would like to know the different type of shells. And also i would like to know the reason for Shell scripts And tell me which will be the best site for UNIX beginners. Regards Sivam. :rolleyes: (5 Replies)
Discussion started by: sivhard
5 Replies
Login or Register to Ask a Question