 music |
 | � | OSdata.com |
command substitutions
summary
����This subchapter looks at command substitutions in Unix (and Linux).
command substitutions
����This subchapter looks at command substitutions in Unix (and Linux).
command substitution
����Command substitution is used to assign the output of a command to a variable.
����Place the command in sideways ticks (`) around the command. Do not confuse these with regular single quotation marks (').
����You can place a simple command, a pipeline, or a command list inside the tick marks.
����An example of a simple command:
����$ DATE=`date`
����An example of a pipeline:
����$ CONSOLEUSER=`who | grep console`
����An example of a command list:
����$ FILEUSAGE=`date ; df`
����You can use command substitution to create parameters for other commands.
����In the following example, the user name is used for grep word search of the file named names:
����$ grep `id -un` names
����You can use $( ) as a replacement for ` `. If you nest backticks inside of each other, you need to escape the internal backticks. You do not need to escape nested $( ).
����$ DATEVAR=$(date)
����$ echo $DATEVAR
����$Mon Aug 26 19:35:47 PDT 2013
����$
����If there is only one level of nesting, some people use the convention of using $() for the outer expression and backicks (``) fr the inner expression.
comments, suggestions, corrections, criticisms
free music player coding example
����Coding example: I am making heavily documented and explained open source code for a method to play music for free � almost any song, no subscription fees, no download costs, no advertisements, all completely legal. This is done by building a front-end to YouTube (which checks the copyright permissions for you).
����View music player in action: www.musicinpublic.com/.
����Create your own copy from the original source code/ (presented for learning programming).
This section is under the category of owning cirticism.
In response to a posting about my article collecting social media, Moderator +Andrew Smith (Technology addict, Web Developer, API guru, futsal and football wannabe, and all round nice guy!, Swordfox Design, arrowtown, new zealand) of the Google+ community Web Developers, Web Designers, Web Coding claims �Quite frankly this is self promotion, and your site is not of great quality. I can see how +Joost Schuur� would think this of not high enough a standard.�
Because I no longer have the computer and software to make PDFs, the book is available as an HTML file, which you can convert into a PDF.
����Names and logos of various OSs are trademarks of their respective owners.