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
Apple Computing Products:
macOS - Operating System
uninstall
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="masaka___" data-source="post: 21793"><p>For deleting single items, there isn't much point to the CLI vs GUI argument. They're both about the same efficiency, so it's not worth getting worked up about it. However, the CLI will shine when you have to perform similar actions on a large amount of data or files. That's because the CLI isn't just about doing one command at a time. Most Unix shells are fully programmable environments where you have access to constructs such as loops and conditional statements just like you'd expect from any other programming language.</p><p></p><p><strong>For Example</strong>:</p><p></p><p>Suppose you went to <a href="http://falcoon.hp.infoseek.co.jp/diary31.htm" target="_blank">http://falcoon.hp.infoseek.co.jp/diary31.htm</a> and were impressed by the artwork so much that you wanted to download the images to your computer so that you could view them offline. As of 2004-02-18, the URL for the top image is <a href="http://falcoon.hp.infoseek.co.jp/images/top1112.jpg" target="_blank">http://falcoon.hp.infoseek.co.jp/images/top1112.jpg</a> and the URL for the bottom image is <a href="http://falcoon.hp.infoseek.co.jp/images/top1105.jpg" target="_blank">http://falcoon.hp.infoseek.co.jp/images/top1105.jpg</a> . And I'm sure you could guess what all the images in between are named. Now, let's download them in one fell swoop.</p><p></p><p>But before we begin, let's get our shells straight. OS X provides 3 different shells -- tcsh (the default), bash, and zsh. First, I'm going to show you an example in tcsh since that's what most of you are probably using. Then I'm going to show you an example in zsh, because it has a nice feature that makes this problem easier to solve. </p><p></p><p>Here's the tcsh example:</p><p>[code]</p><p>foreach i (1105 1106 1107 1108 1109 1110 1111 1112)</p><p> curl -O http://falcoon.hp.infoseek.co.jp/images/top${i}.jpg</p><p>end</p><p>[/code]</p><p></p><p>I chose to type out the list of numbers, because it wasn't that long. However, if I had a few hundred images to download, I would have generated the list of numbers programmatically. </p><p></p><p>Zsh has a built-in notation {x..y} for generating numeric lists which is one of the many reasons I prefer it over other shells. For example:</p><p></p><p>[code]</p><p>zsh</p><p>for i in {1105..1112} ; do</p><p> curl -O http://falcoon.hp.infoseek.co.jp/images/top${i}.jpg</p><p>done</p><p>exit</p><p>[/code]</p><p></p><p>(The exit at the end was so you could get out of zsh and back into the original shell that you started with.)</p><p></p><p>The purpose of these examples was to demonstrate a certain class of operations where a programmable shell environment really shines. I hope you all find this instructive, and I kinda look forward to showing you all more techniques in the future.</p></blockquote><p></p>
[QUOTE="masaka___, post: 21793"] For deleting single items, there isn't much point to the CLI vs GUI argument. They're both about the same efficiency, so it's not worth getting worked up about it. However, the CLI will shine when you have to perform similar actions on a large amount of data or files. That's because the CLI isn't just about doing one command at a time. Most Unix shells are fully programmable environments where you have access to constructs such as loops and conditional statements just like you'd expect from any other programming language. [b]For Example[/b]: Suppose you went to [url]http://falcoon.hp.infoseek.co.jp/diary31.htm[/url] and were impressed by the artwork so much that you wanted to download the images to your computer so that you could view them offline. As of 2004-02-18, the URL for the top image is [url]http://falcoon.hp.infoseek.co.jp/images/top1112.jpg[/url] and the URL for the bottom image is [url]http://falcoon.hp.infoseek.co.jp/images/top1105.jpg[/url] . And I'm sure you could guess what all the images in between are named. Now, let's download them in one fell swoop. But before we begin, let's get our shells straight. OS X provides 3 different shells -- tcsh (the default), bash, and zsh. First, I'm going to show you an example in tcsh since that's what most of you are probably using. Then I'm going to show you an example in zsh, because it has a nice feature that makes this problem easier to solve. Here's the tcsh example: [code] foreach i (1105 1106 1107 1108 1109 1110 1111 1112) curl -O http://falcoon.hp.infoseek.co.jp/images/top${i}.jpg end [/code] I chose to type out the list of numbers, because it wasn't that long. However, if I had a few hundred images to download, I would have generated the list of numbers programmatically. Zsh has a built-in notation {x..y} for generating numeric lists which is one of the many reasons I prefer it over other shells. For example: [code] zsh for i in {1105..1112} ; do curl -O http://falcoon.hp.infoseek.co.jp/images/top${i}.jpg done exit [/code] (The exit at the end was so you could get out of zsh and back into the original shell that you started with.) The purpose of these examples was to demonstrate a certain class of operations where a programmable shell environment really shines. I hope you all find this instructive, and I kinda look forward to showing you all more techniques in the future. [/QUOTE]
Verification
Post reply
Forums
Apple Computing Products:
macOS - Operating System
uninstall
Top