Specerion
Specerion

Reputation: 115

How to save inputted txt file to variable bash

I want to prompt the user to type in a text file then save that text file as a variable so I can manipulate it further within the rest of my shell script. (For instance, save it to a different filename, edit the data inside, etc).

Unfortunately I don't have a good starting point as everything I've tried so far has failed.

Upvotes: 0

Views: 76

Answers (1)

MelBurslan
MelBurslan

Reputation: 2501

read -p "what file name you want to use" filename

echo ${filename} #or whatever you want to do with filename variable

Upvotes: 1

Related Questions