• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Using 'echo' from 'do shell script'
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Using 'echo' from 'do shell script'


  • Subject: Re: Using 'echo' from 'do shell script'
  • From: Matthew Stuckwisch <email@hidden>
  • Date: Sat, 18 May 2002 11:48:20 -0500

OS X 10.1.4, AppleScript version 1.8.2 reported.

set joe to "joe" & return & "joe" & return
do shell script "echo " & joe & " >~/Desktop/joe.txt"


I'm ending up with a linefeed character at the end of the output file (as opened in BBEdit Lite) unless I use the '-n' arg to 'echo'. Is there something wrong with the way I'm formating the input to 'do shell script'
?

The -n argument removes any trailing new lines. The string you are echoing is what is between the hypens:
[snip]
If you set joe to "joe" & return & "joe", then you won't need the extra -n flag.

Erm, scratch that. I reread the echo man file over breakfast and echo by nature adds a \n to each output. Reason for this is so that text can properly display in a terminal:

[localhost:~] guifa% echo lalala
lalala
[localhost:~] guifa% echo -n lalala
lalala[localhost:~] guifa%

The -n flag is used to remove this extra line. I don't quite see a problem with using the -n flag though, so you be okay just using it.

Matthew Stuckwisch
[AIM/MSN]{GuifaSwimmer} | [Yahoo!]{SapphireTree} | [ICQ]{137477701}
[IRC]{guifa / G}(esperNET / irc.massinova.com)
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.

  • Follow-Ups:
    • Re: Using 'echo' from 'do shell script'
      • From: Philip Aker <email@hidden>
References: 
 >Re: Using 'echo' from 'do shell script' (From: Matthew Stuckwisch <email@hidden>)

  • Prev by Date: Re: Using 'echo' from 'do shell script'
  • Next by Date: do shell script non-ASCII
  • Previous by thread: Re: Using 'echo' from 'do shell script'
  • Next by thread: Re: Using 'echo' from 'do shell script'
  • Index(es):
    • Date
    • Thread