× {{alert.msg}} Never ask again
Get notified about new tutorials RECEIVE NEW TUTORIALS

Bash can help when a Linux program's options aren't working for you

Robb Shecter
Jun 02, 2015
<p>There are hundreds of extremely useful, small Linux programs like <code>curl</code>, <code>find</code>, <code>wget</code>, and <code>sort</code>. The downside is that each one has its own options for doing things such as saving the output to a file. <span style="color:rgb(95, 99, 102)">The scenario gets more complicated because there are different versions of the programs on the various OS's, and they have different options available.</span></p> <p>I just got done helping a client with the problem of <code>curl</code> not saving its output to a file. </p> <p>My solution: don't worry about <code>curl</code>'s particular way of specifying an output file. Instead, use "standard output redirection" — something which bash provides, and which works with all programs. Learn bash well, and you can use it everywhere.</p> <p>In a nutshell, this version using a <code>curl</code> option:</p> <p>   <code>curl http://somewhere.com -o output.txt</code></p> <p>... can be accomplished with redirection, provided by bash:</p> <p>  <code>curl http://somewhere.com &gt; output.txt</code></p> <p> </p>

Get New Tutorials Delivered to Your Inbox

New tutorials will be sent to your Inbox once a week.

comments powered by Disqus