Forums
New posts
Articles
Product Reviews
Policies
FAQ
Log in
Register
What's new
Search
Search
Search titles only
By:
New posts
Menu
Log in
Register
Install the app
Install
Forums
macOS & iOS Developer Playground
macOS - Development and Darwin
noob shell scripting question
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Reply to thread
Message
<blockquote data-quote="mikeb" data-source="post: 821928" data-attributes="member: 93053"><p>Hi all,</p><p></p><p>Just got this book on shell scripting and thought I'd give it a go.</p><p></p><p>Here's my script:</p><p></p><p>[CODE]#! /bin/sh</p><p></p><p># titleterm - tells Terminal to change its title to the specified value</p><p></p><p>if [ $# != 1 ]; then</p><p> echo "Usage: $0 title" >&2</p><p> exit 1</p><p>else</p><p> echo -n "\033]0;$1\007"</p><p>fi</p><p></p><p>exit 0[/CODE]</p><p></p><p>My problem is with the "-n" option in the second echo command... if I run echo in the command prompt the "-n" option works as advertised, but in the script, -n is interpreted as the string "-n" and not as an option. I'm guessing it's a syntax issue... any suggestions?</p><p></p><p>-Mike</p></blockquote><p></p>
[QUOTE="mikeb, post: 821928, member: 93053"] Hi all, Just got this book on shell scripting and thought I'd give it a go. Here's my script: [CODE]#! /bin/sh # titleterm - tells Terminal to change its title to the specified value if [ $# != 1 ]; then echo "Usage: $0 title" >&2 exit 1 else echo -n "\033]0;$1\007" fi exit 0[/CODE] My problem is with the "-n" option in the second echo command... if I run echo in the command prompt the "-n" option works as advertised, but in the script, -n is interpreted as the string "-n" and not as an option. I'm guessing it's a syntax issue... any suggestions? -Mike [/QUOTE]
Verification
Post reply
Forums
macOS & iOS Developer Playground
macOS - Development and Darwin
noob shell scripting question
Top