Welcome to the new Linux Foundation Forum!

Dir management inside batch

Hi guys.

I'm trying do task with directories and tar inside a batch but for some reason I still don't understand my batch doesn't accept my commands, example:

!/bin/sh

$DIR
$DAY
$TIME

DAY=date +%A
TIME=date +%k

if [ $TIME = "2" ]
then
DIR='a'
elif [ $TIME = "15" ]
then
DIR='b'
else
DIR='c'
fi

/usr/bin/cd /opt/video18/$DAY/$DIR
/usr/bin/rm -rf ./*
/usr/bin/dd if=/dev/sda of=/opt/video18/$DAY/$DIR/disk.img count=1024 count=3 bs=1024

pwd

The ouput is:
/opt/video18/Wednesday/a

But I doesn't have my dd output, my dir is empty.

Something I'm doing wrong :-?

Centos 7.x, thanks guys for your time.

Sign In or Register to comment.