Place the results of a CUT command into a variable

I am being passed a file in UNIX, ie: variable.txt

I need to extract the first part of the file content, up to the period, content ie: common_dir.second_output

cut -d'.' -f1 /content/stores/variable.txt

I then need to utilize the results to create a variable ($1), and test on that result. ie: $1 = common_dir

 if test -d /var/mqsi/deploy/$1
            then cd /var/mqsi/deploy && rm -Rf $1
             echo /var/mqsi/deploy/$1 deleted.
 else
             echo /var/mqsi/deploy/$1 does not exist.
 fi

How do I pipe or place the results of the cut command into the variable $1, so $1 = common_dir

Or what is the best command to accomplish this?

Is this a homework assignment?

This is a small part, and the easiest part, of fully automating a BAR File deployment.

The script I am writing will access a product called REMEDY to extract a deployment ticket, it will then automatically extract the code from a software repository called StarTeam, it will then FTP the code to Servers and perform an automated deployment of a BAR file.

The file that will be passed will contain much more information than what was indicating, including (but not limited to) the StarTeam project name, View Labels, BAR and TAR files to be deployed, Target Servers and Directories, and other information.

The information that I provided was a small part of the process and only involved with verifying and removal of the old Execution Group Directory.

If the code you listed previously:

 if test -d /var/mqsi/deploy/$1
            then cd /var/mqsi/deploy && rm -Rf $1
             echo /var/mqsi/deploy/$1 deleted.
 else
             echo /var/mqsi/deploy/$1 does not exist.
 fi

is in a separate script, you can invoke it using:

script_name $(cut -d'.' -f1 /content/stores/variable.txt)

which will set $1 in that script to the string returned by cut .

Otherwise, to set $1 in your current shell execution environment, you could use:

set -- $(cut -d'.' -f1 /content/stores/variable.txt)

Thanks, I will try this.