0

So I have a project which needs to create a list of numbers which then will be sum all together and more, but right now, one of my problems is that that I need to give the user the option to decide what the name of the file will be, so I have a very little knowledge of unix so help would be good

  1. usr/bin/bash
  2. clear;
  3. echo enter name
  4. read v
  5. cat > v

this is what I have, it's creating the file but as you can already tell, the file name will be v; any thoughts on how I can fix this code?

0
#!/bin/bash
clear
read -p "enter name" v
echo "Beginning" >$v
  • Rather than posting a "Thank You" comment, click the checkmark beside the answer to Accept it. Thanks. – waltinator Apr 2 at 3:27
0

This simple script will create file name based on user input.

#!/bin/bash
echo "Please enter the file name you want"
read USERFILENAME
touch $USERFILENAME

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.