Monday, 23 July 2012

Single application to convert Audio, Video, Image and Document files to other formats

FF Multi Converter is a simple graphical application which enables you to convert audio, video, image and document files between all popular formats, using and combining other programs.

It uses ffmpeg for audio/video files, unoconv for document files and PythonMagick library for image file conversions. Common conversion options for each file type are provided. Audio/video ffmpeg-presets management and recursive conversion options are available too.

FF Multi Converter Features
 * Conversions for several file formats.
 * Very easy to use interface.
 * Access to common conversion options.
 * Audio/video ffmpeg-presets management.
 * Options for saving and naming files.
 * Recursive conversions.

Continue Reading...

Thursday, 19 July 2012

Bash Script: Difference betweem single ( ' ) and double quotes ( " )

The Bash manual has this to say:

Single Quotes
Enclosing characters in single quotes (‘'’) preserves the literal value of each character within the quotes. A single quote may not occur between single quotes, even when preceded by a backslash.

Double Quotes
Enclosing characters in double quotes (‘"’) preserves the literal value of all characters within the quotes, with the exception of ‘$’, ‘`’, ‘\’, and, when history expansion is enabled, ‘!’. The characters ‘$’ and ‘`’ retain their special meaning within double quotes (see Shell Expansions). The backslash retains its special meaning only when followed by one of the following characters: ‘$’, ‘`’, ‘"’, ‘\’, or newline. Within double quotes, backslashes that are followed by one of these characters are removed. Backslashes preceding characters without a special meaning are left unmodified. A double quote may be quoted within double quotes by preceding it with a backslash. If enabled, history expansion will be performed unless an ‘!’ appearing in double quotes is escaped using a backslash. The backslash preceding the ‘!’ is not removed.

The special parameters ‘*’ and ‘@’ have special meaning when in double quotes (see Shell Parameter Expansion).

Continue Reading...

Wednesday, 18 July 2012

Bash script: Using shift statement to loop through command line arguments

A shift statement is typically used when the number of arguments to a command is not known in advance and it takes a number (N), in  which the positional parameters are shifted to the left by this number, N.

Say you have a command that takes 10 arguments, and N is 4, then $4 becomes $1, $5 becomes $2 and so on. $10 becomes $7 and the original $1, $2 and $3 are thrown away.

Below is the simple example showing the usage of 'shift' statements:

Source:  cat shift2.sh
#!/bin/bash

echo "Total number of arg passed: $#"
echo "arg values are: $@"
echo "-----------------------------------------"

while [[ $# > 0 ]] ; do
        echo "\$1 = $1"
        shift
done

echo

Output: ./shift2.sh a b c d e f
Total number of arg passed: 6
arg values are: a b c d e f
-----------------------------------------
$1 = a
$1 = b
$1 = c
$1 = d
$1 = e
$1 = f




Tuesday, 17 July 2012

Bash Script: Using Globbing (glob) in bash script


Glob characters
* - means 'match any number of characters'. '/' is not matched
? - means 'match any single character'
[abc] - match any of the characters listed. This syntax also supports ranges, like [0-9]

Below is a simple script which explains the problem and also provide the solution using globbing:

Source:
cat glob.sh
#!/bin/bash

echo "Creating 2 files with space: this is first file.glob and another file with name.glob "
`touch "this is first file.glob"`
`touch "another file with name.glob"`

echo "---------------------------------"
echo "Using for loop to search and delete file ... failed :( "
for file in `ls *.glob`; do
        echo $file
        `rm $file`
done

echo "-------------------------------"
echo
echo "Using the another for loop to search for the same set of files ... but failed :("
for filename in "$(ls *.glob)"; do
        echo $filename
        `rm $filename`
done

# This is the example of using glob in the script
# This time BASH does know that it's dealing with filenames
echo "-------------------------------"
echo "Finnaly able to delete the file using glob method. :)"
for filename in *.glob; do
        echo "$filename"
        `rm "$filename"`
done


Continue Reading...

 
//PART 2