3

I tried storing the contents of a file in an environment variable using one of those commands.

a= cut -f 1 abc.txt

cut -f 1 abc.txt >a 

neither works .

So , can anybody help me out?

Maythux
  • 87,123
xeon
  • 295

1 Answers1

2
a= cut -f 1 abc.txt

This doesn't work, this will assign the word 'command' cut to the variable a. The correct syntax is

a=`cut -f 1 abc.txt`

Now you can run the command

echo $a

and check the result. Works


The second command

cut -f 1 abc.txt >a 

This will redirect the output of the command cut -f 1 abc.txt into a newly created file named a and not a variable a.

Maythux
  • 87,123