![]() |
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !! |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Perl Hash | Harikrishna | Shell Programming and Scripting | 1 | 06-03-2008 12:45 AM |
| Hash in perl | Harikrishna | Shell Programming and Scripting | 1 | 06-02-2008 05:00 AM |
| Hash within array, within hash, within array... | jsmoriss | Shell Programming and Scripting | 1 | 07-10-2006 10:26 PM |
| Perl: Pattern Matching a HASH variable | pondlife | Shell Programming and Scripting | 1 | 04-10-2006 04:31 PM |
| How to create md5 Hash variable? | cstovall | Shell Programming and Scripting | 1 | 02-05-2006 07:03 PM |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
||||
|
Hash (#) as a variable
Hi
I'm writing a cript that copies and renames files to a backup location. This script can be used in a "test" mode, whereby all the files that will be copied are listed. The problem is that the destination file will not yet exist, so I want to comment this part (I'm shure you'll see what I'm getting at from the example below!) I have the following in the script: Code:
if test "$control_code" = "cp"; then echo "" echo "You have chosen $control_code" echo "Files are being copied." echo "" ext="/backup" else echo "" echo "You have chosen $control_code" echo "No files will be copied, only tested" echo "" control_code="ls -l" ext=# fi ... echo "cp /dir/testfile /backup/testfile_1" $control_code /dir/testfile $ext/testfile_1 echo "cp /u01/testfile /backup/testfile_2" $control_code /u01/testfile $ext/testfile_2 ... #/testfile_1: No such file or directory #/testfile_2: No such file or directory You can see that the hash (#) comment value is not recognised. How can this be done??? Any help would be greatly appreciated!!! added code tags for readability --oombera Last edited by oombera; 02-19-2004 at 11:28 AM.. |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|