Rama
Rama

Reputation: 175

create a directory name using the data in a file

I am having date in one file called sms.txt as below:

10032020

I need to use this data in sms.txt and set to a variable(old_data) and create it as directory a directory name. I tried the below code :

#!/bin/bash
set old_data = $(cat sms.txt)
mkdir $old_data

I need to create the directory name as 10032020. But the directory name is not getting printed!

Upvotes: 0

Views: 273

Answers (1)

Cyrus
Cyrus

Reputation: 88583

This should do the job:

xargs mkdir <sms.txt

See: man xargs

Upvotes: 3

Related Questions