![]() |
|
|
|
|
|||||||
| Forums | Portal | Register | Forum Rules | FAQ | Contribute | Members List | Arcade | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts here. |
|
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| "find command" to find the files in the current directories but not in the "subdir" | swamymns | Shell Programming and Scripting | 9 | 07-22-2008 08:23 AM |
| Strange error "host: isc_taskmgr_create: no available threads" | Santi | Linux | 0 | 01-03-2008 02:49 AM |
| Listing only directories in the current working directory using the "ls" command | igandu | UNIX for Dummies Questions & Answers | 2 | 05-12-2006 01:47 AM |
| Unix "at" / "Cron" Command New Problem...Need help | Mohanraj | UNIX for Dummies Questions & Answers | 3 | 01-26-2006 05:08 PM |
| chmod 777 on all directories below...how do I do that using the "find" command? | Neko | UNIX for Dummies Questions & Answers | 7 | 07-12-2001 06:58 PM |
|
|
Submit Tools | LinkBack | Thread Tools | Display Modes |
|
#1
|
||||
|
||||
|
I have a problem using bash. Simply, I cannot find the right command (if there's one!) to enter in the "- Arch_02 -" directory. As you can see, the name begins with a hyphen and this is causing some trouble:
Code:
localhost arch2 # pwd /mnt/arch2 localhost arch2 # ls -l total 4 dr-x------ 1 root root 4096 2007-04-29 20:09 - Arch_02 - dr-x------ 1 root root 0 2006-12-10 18:14 RECYCLER dr-x------ 1 root root 0 2006-12-02 22:24 System Volume Information localhost arch2 # cd -\ Arch_02\ - bash: cd: - : invalid option cd: usage: cd [-L|-P] [dir] localhost arch2 # cd "- Arch_02 -" bash: cd: - : invalid option cd: usage: cd [-L|-P] [dir] localhost arch2 # cd '- Arch_02 -' bash: cd: - : invalid option cd: usage: cd [-L|-P] [dir] localhost arch2 # cd - -\ Arch_02\ - /root localhost ~ # cd /mnt/arch2 localhost arch2 # cd - "- Arch_02 -" /root If I use csh instead, I can regularly access the directory by issuing the command: Code:
(localhost:/mnt/arch2) # cd "- Arch_02 -" (localhost:/mnt/arch2/- Arch_02 -) # pwd /mnt/arch2/- Arch_02 - Does anyone have the answer? Thanks a lot! |
| Forum Sponsor | ||
|
|
|
#2
|
||||
|
||||
|
Code:
cd -- '- Arch_02 -' |
|
#3
|
||||
|
||||
|
Here is how you can do it:
Code:
cd ./*Arch_02* Last edited by Shell_Life; 07-06-2007 at 01:50 PM. |
|
#4
|
||||
|
||||
|
Wow! Many many thanks! Both solutions are working great.
By the way, now that I have the answer I think I should have read more carefully the options in man bash |
||||
| Google The UNIX and Linux Forums |