![]() |
|
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 | |
|
Programmer
|
Counter
I have this bash script:
#! /bin/bash # Script which shows how many Microsoft programs are # on the computer. PTH="C:\Program Files" cd $PTH ls -1 | grep "Microsoft" | wc -l exit When I run it in Cygwin, I get this: Quote:
I've tried putting a backslash before the space, removing the quotes and a combination of both. Another thing is, when I do cd "C:\Program Files" or cd C:\Program\ Files on the command line, both work fine. According to what I did in the script they should have failed. How can I fix this?
__________________
David Morris BSc.(Hons), MBCS Qualified Computer Engineer Administrator (SEED Software) |
|
|
|
|
|
|
#2 |
|
Programmer
Join Date: Feb 2006
Location: 127.0.0.1
Posts: 35
Rep Power: 0
![]() |
When it calls the variable PTH it does not call it with the quotation marks as they are used to state that what is inside is a string.
Try putting another set of quotation marks inside the string. I haven’t done scripting in a while and i got nothing to try it out on but that what it looks like from where I’m sitting. |
|
|
|
|
|
#3 |
|
Unverified User
Join Date: Aug 2005
Location: none
Posts: 146
Rep Power: 0
![]() |
Why is the variable even there? Why isn't it just cd "C:\Program Files".
__________________
Warning: My posts may change (dramatically) within the first 15 minutes they're posted. Got 'Nux?—GNU/Linux and other free software support. It's GNU/Linux, not just Linux. |
|
|
|
![]() |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| PHP Counter Script | Toro | PHP | 3 | Jun 8th, 2006 12:01 AM |
| Process Id to Performance Counter Name | coder0xff | C++ | 1 | May 29th, 2006 11:19 AM |
| ASP Hit Counter | raikkonen | ASP | 2 | Nov 9th, 2005 5:51 AM |
| Web Counter | Sane | Python | 9 | Aug 8th, 2005 1:32 PM |
| Help with counter | Supreme | C++ | 1 | Jun 5th, 2005 10:29 PM |