User Tools

Site Tools


tutorials:bash_scripting:part4

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
tutorials:bash_scripting:part4 [2012/06/19 12:30] rmilestutorials:bash_scripting:part4 [2017/10/12 21:58] (current) – external edit 127.0.0.1
Line 175: Line 175:
  
  
-My //con2vob// script listed above is too short to require functions but it will serve as a good example of how to use functions. It will also serve as the core of a more complex script that also burns DVDs which I will introduce in **Part 5** of this series. +My //con2vob// script listed above is too short to require functions but it will serve as a good example of how to use functions.
  
  
Line 228: Line 227:
 </code> </code>
  
-In this script two variable declarations are listed first. The variable //input_file// must be declared before the three functions because that variable is used in all three functions. The variable //dvd_size// does not have to be declared until required in the function //shrink_video// but I like to list all all variables I may want to shange at the beginning of the script where they are easy to find if I want to change them.+In this script two variable declarations are listed first. The variable //input_file// must be declared before the three functions because that variable is used in all three functions. The variable //dvd_size// does not have to be declared until required in the function //shrink_video// but I like to list all all variables I may want to change at the beginning of the script where they are easy to find if I want to change them.
  
-Note that I have changed the notation when I use stdout from a command to assign a value to a variable. The use of backticks, e.g. variable=`some command` for command substitution has been depreciated and the new way is to use " $()" like this variable=$(some command) Backticks can still be used but you may have mixed results and they should not be used when using nested commands.+Note that I have changed the notation when I use stdout from a command to assign a value to a variable. The use of backticks, e.g. //variable=`some command`// for command substitution has been depreciated and the new way is to use " $() " like this  //variable=$(some command)// Backticks can still be used but you may have mixed results and they should not be used when using nested commands.
  
 It is possible to do math in Bash if the numbers involved are all integers. In such instances you must use double quotes. It is possible to do math in Bash if the numbers involved are all integers. In such instances you must use double quotes.
Line 249: Line 248:
  
 ---- ----
-**N.B.** There are gui programs out there which will do exactly what my con2vob script does but how many mouse clicks, how much time and how much memory does it take? I started scripted encoding and burning when I had a server for printer and file shares that also had a dvb card on board so saved movies and docos would be availble to any client on demand. Encoding takes a long time and is resource intensive but it didn't matter to a headless box with memory to spare and it could be done any time, day or night. It was just a matter of ssh'ing into the server and running a script.+//There are gui programs out there which will do exactly what my con2vob script does but how many mouse clicks, how much time and how much memory does it take? I started scripted encoding and burning when I had a server for printer and file shares that also had a dvb card on board so saved movies and docos would be availble to any client on demand. Encoding takes a long time and is resource intensive but it didn't matter to a headless box with memory to spare and it could be done any time, day or night. It was just a matter of ssh'ing into the server and running a script.// 
 + 
 +I//'m not running that server now but I still prefer to do this sort of thing with scripts. I only use it on saved DVB broadcasts so the settings can remain the same. I either run con2vob with //nice// and go about doing something else or else run it when I go to bed or walk out the door and let the machine shut itself down when it is finished.// 
  
-I'm not running that server now but I still prefer to do this sort of thing with scripts. I only use it on saved DVB broadcasts so the settings can remain the same. I either run con2vob with //nice// and go about doing something else or else run it when I go to bed or walk out the door and let the machine shut itself down when it is finished.  
 ---- ----
  
 **Cheers!** **Cheers!**
  
tutorials/bash_scripting/part4.1340073004.txt.gz · Last modified: 2017/10/12 21:58 (external edit)