tutorials:bash_scripting:part4
Differences
This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| tutorials:bash_scripting:part4 [2012/06/19 01:46] – rmiles | tutorials:bash_scripting:part4 [2017/10/12 10:58] (current) – external edit 127.0.0.1 | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| - | |||
| // | // | ||
| Line 14: | Line 13: | ||
| - | I can use a short one command script to save me the trouble of remembering (and typing) a very long // | + | I can use a a short one command script to save me the trouble of remembering (and typing) a very long // |
| Line 64: | Line 63: | ||
| In this script the video is assigned to the variable // | In this script the video is assigned to the variable // | ||
| - | I use mencoder (from MPlayer) for encoding my videos. The command options in the script are provided in the MPlayer manual //**7.8. Using MEncoder to create VCD/ | + | I use mencoder (from MPlayer)for encoding my videos. The command options in the script are provided in the MPlayer manual //**7.8. Using MEncoder to create VCD/ |
| Line 72: | Line 71: | ||
| - | The linux operating systems use a block size of 1024 bytes, i.e.1kb. I want the script to shrink the video if the video exceeds 4.2gb and 4,400,000kb equals | + | The linux operating systems use a block size of 1024 bytes, i.e.1kb. I want the script to shrink the video if the video exceeds 4.2gb and 4,400,000kb equals |
| Line 92: | Line 91: | ||
| - | Bash will do simple math and it only works with integers. For floating point math I have to use //bc//. The shrink | + | Bash will do simple math but for floating point math I have to use //bc//. The requant |
| Line 176: | 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. | + | 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 229: | Line 227: | ||
| </ | </ | ||
| - | In this script | + | In this script two variable declarations are listed first. The variable // |
| - | 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 | + | 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 |
| - | It is possible to do math in Bash if the numbers involved are all integers | + | It is possible to do math in Bash if the numbers involved are all integers. In such instances |
| < | < | ||
| Line 245: | Line 243: | ||
| </ | </ | ||
| - | **in progess** | + | In // |
| + | |||
| + | In **Part 5** of this series I will present a script that encodes shrinks and burns to a DVD. It is a little more complicated so it is a good example to show how handy functions can be in both planning and writing 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' | ||
| + | |||
| + | 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!** | ||
tutorials/bash_scripting/part4.1340070375.txt.gz · Last modified: 2017/10/12 10:58 (external edit)