Code Sample |
echo -n "${CYAN}Use journalized ext3 filesystem (not recommended on slower systems) (y/n)?${NORMAL} " read FSTYPECHOICE if [ "$FSTYPECHOICE" != "y" ]; then FSTYPE=ext2 else FSTYPE=ext3 fi echo "${CYAN}Last chance to exit before destroying any data on ${MAGENTA}$TARGET!!${NORMAL}" echo -n "Continue (y/..)? ${NORMAL}" read answer if [ "$answer" != "y" ]; then echo "Aborted.." exit 0 fi echo "${BLUE}Creating filesystem $FSTYPE on $TARGET...${NORMAL}" sleep 2 dd if=/dev/zero of=$TARGET bs=1k count=16 >/dev/null 2>&1 sync if [ "$FSTYPE" != "ext3" ]; then mke2fs $TARGET 2> $TMP else mke2fs -j $TARGET 2> $TMP fi x=$? if [ $x != 0 ]; then echo "${RED}An error occurred while creating the filesystem.${NORMAL}" echo "Some messages from mkfs:" tail -8 $TMP rm -f $TMP exit 0 fi |
Code Sample |
echo -n "${CYAN}Use journalized ext3 filesystem (not recommended on slower systems) (y/n)?${NORMAL} " read FSTYPECHOICE if [ "$FSTYPECHOICE" != "y" ]; then FSTYPE=ext2 else FSTYPE=ext3 fi echo -n "${CYAN} Skip the partitioning and format and go directly to File copy (y/n)?${NORMAL} " read SKIPCOPY if [ "$SKIPCOPY" != "y" ]; then echo "Skipped..." else echo "${CYAN}Last chance to exit before destroying any data on ${MAGENTA}$TARGET!!${NORMAL}" echo -n "Continue (y/..)? ${NORMAL}" read answer if [ "$answer" != "y" ]; then echo "Aborted.." exit 0 fi echo "${BLUE}Creating filesystem $FSTYPE on $TARGET...${NORMAL}" sleep 2 dd if=/dev/zero of=$TARGET bs=1k count=16 >/dev/null 2>&1 sync if [ "$FSTYPE" != "ext3" ]; then mke2fs $TARGET 2> $TMP else mke2fs -j $TARGET 2> $TMP fi x=$? if [ $x != 0 ]; then echo "${RED}An error occurred while creating the filesystem.${NORMAL}" echo "Some messages from mkfs:" tail -8 $TMP rm -f $TMP exit 0 fi fi |