2008/8/22, Bill Bumgarner <[EMAIL PROTECTED]>:
>
> On Aug 22, 2008, at 1:00 AM, Vladimir Sokolov wrote:
>
>> Hello All,
>>
>> I am working on a command line tool. I use
>> NSArray *params = [[NSProcessInfo processInfo] arguments]
>> to get a list of command line parameters.
>> Then I use
>>  NSString *param1 = [params objectAtIndex:1];
>> to get it.
>>
>> But when I pass for example >...myapplication test$test
>> param1 got "testest" instead of  ""test$test"
>>
>> It means as I understand that $ is interpreted as special character.
>>
>> So my question is how to pass a parameter with $ inside?
>> And are there any other special characters which are interpreted as
>> special
>> one?
>>
>
> To be clear, this has nothing to do with NSString and everything to do with
> how the shell parses command lines.
>
> As Michael D alluded to, the shell is seeing $test and "expanding" the $t
> to be the value of -- typically -- the environment variable 't', which
> doesn't have a value and, thus, you end up with 'testest'.
>
> That is, all argument processing has been completed long before your
> command line tool is even launched.
>
> Now, the syntax and rules for substitution change depending on the shell
> used and how your command line tool is launched.  As well, APIs for
> launching processes such as NSTask, popen(), system(), and the various
> fork()/exec*() combinations may or may not behave similarly.
>
> So -- the real questions:
>
> What is launching your command line tool?
>
> Do you really need an argument with a $ character in it?
>
> Most command line tools avoid such characters for the reasons stated above.
>
> Have you read this book?  http://tinyurl.com/6kxxgc
>
> b.bum
>
>
>
Thanks for your messages.

Now I see my problem ( Learn Unix! :))

The $ character is part of the user password, that is why I need to use it.
Now for the test I am launching my tool in bash.

thanks again,
Vlad
_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]

Reply via email to