Differences

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

Link to this comparison view

development:bash:ifs [2018/12/17 20:16] (current)
preb created
Line 1: Line 1:
 +[[:​development:​bash|Back]]
 +==== Internal Field Separator ====
  
 +By default the shell uses white space to split field in a variable. \\
 +To avoid this we can define an alternate IFS value. \\
 +Here is a script which reads all the flac files in a directory and converts them to mp3, renaming them at the same time.
 +<​code>​
 +#!/bin/bash
 +#
 +IFS=$'​\n'​
 +for a in `ls *.flac`
 +do
 +b=`echo ${a} | sed '​s/​flac/​mp3/'​`
 +ffmpeg -i ${a} -qscale:a 0 ${b}
 +done
 +</​code>​
  • development/bash/ifs.txt
  • Last modified: 2018/12/17 20:16
  • by preb