#!/bin/bash if [[ $# -lt 2]] then ech"Usage: ./bin2dot-with-read.sh " exit fi if [[ $# -f $1]] then echo "File $1 does not exist !" exit fi if [[ $# -f $2]] thenecho -n "$2 exists. Overwrite ? Yes/No --> " read answer if [[answer == Yes]] then cp /dev/null $2 else done fi lignes = $(cat $1) while read i do x = $(expr substr $i 1 8) y = $(expr substr $i 9 8) z = $(expr substr $i 17 8) t = $(expr substr $i 25 8) echo "$((2#$x)).$((2#$y)).$((2#$z)).$((2#$t))" done <$1 >$2 exit