Re: ctrl m question
Re: ctrl m question
- Subject: Re: ctrl m question
- From: "Mark J. Reed" <email@hidden>
- Date: Fri, 1 Dec 2006 17:35:59 -0500
Note that in the shell, control-M is not actually an EOL. There's
terminal handling code which does magic to translate it - you hit the
return key, control-M gets sent, but the shell sees control-J instead.
(The same terminal handling code does the control-V stuff). But
that's only there when you're talking to a terminal - which "do shell
script" isn't. So you don't need to do anything special with carriage
returns - they're just another character to the shell, and you may
sprinkle them liberally throughout your command strings.
If, on the other hand, you want to send a literal newline (ASCII
character 10) and not have the shell treat it as "end of command", it
needs to be inside quotation marks or preceded by a backslash.
On 12/1/06, Ian Ward Comfort <email@hidden> wrote:
On Dec 1, 2006, at 2:04 PM, John C. Welch wrote:
> Okay, so to create a ^M for an eol in the shell, you hit ctrl-v
> then ctrl-m.
>
> What would be the best way to represent that in a do shell script
> command,
> as "^M" is just two characters?
The "return" constant in AppleScript is actually ASCII character 13.
So this:
set x to (do shell script "echo " & return & " | cat -v")
display dialog x
pops up a dialog reading ^M on my system.
—IWC
_______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/mailman//archives/applescript-users
This email sent to email@hidden
--
Mark J. Reed <email@hidden>
_______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/mailman//archives/applescript-users
This email sent to email@hidden