Bash beginner

Login or Register for Dates, Times and to Reply

Thread Tools Search this Thread
Top Forums UNIX for Beginners Questions & Answers Bash beginner
# 1  
Bash beginner

Hello so I've stored some csv data to be read into variables like this

 while IFS=$sep read Name Team Shop Shoe


   while [ -d "$dirname" ]

   mkdir -p $dirname/{Personal,Food,Pictures}

echo "Hello my name is $Name i play for $Team i shop at $Shop and my shoe size is $Shoe"  < $dirname/Personal/starter.txt

done } <$file_name

When using the mkdir command to make the directories based on $dirname it works perfectly and i get all directories made based on each name, however when trying to Echo text into a file called starter.txt it gives me an error says the file or name doesn't exist. I'm trying to get it to generate ths file for every user. This is the full error
Paul/Personal/starter.txt: No such file or directory

this lists this error 20 times because of 20 users and 20 differnty names however is finding directory but not making file?

please help.

Moderator's Comments:
Mod Comment
As per forum rules, please use tags.

Last edited by RavinderSingh13; 11-28-2019 at 10:36 PM..
# 2  
You are not redirecting stdout to a text file with < but redirecting stdin to read from a (yet) non-existing file.
This User Gave Thanks to RudiC For This Post:
# 3  
I think i get what you are saying but

# Redirect stdout to a file.
# Creates the file if not present, otherwise overwrites it.

I thought this would actually create if not preseent, have i done something wrong in the previous bit?
# 4  
Look at the two different redirection operators!
This User Gave Thanks to RudiC For This Post:
# 5  
sorted it thank you, was so simple lol
Login or Register for Dates, Times and to Reply

Previous Thread | Next Thread
Thread Tools Search this Thread
Search this Thread:
Advanced Search

Test Your Knowledge in Computers #547
Difficulty: Medium
unary operators only operate on universal variables.
True or False?

10 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

Beginner bash - basic shell script 'while' help...

Hi everyone, first time visitor to these forums here. Keeping a long story short I've been attempting to learn how to code in bash. I have VERY little previous experience with coding languages besides simply copying and pasting batch scripts for Windows. So, with that in mind I've followed a... (4 Replies)
Discussion started by: Meta
4 Replies

2. UNIX for Beginners Questions & Answers

Beginner at bash scripting - need help with passing arguments

I at the moment, making a simple bash script, capable of setting up an workspace for me, so i don't have to do it manually.. Problem is though i can't seem to provide the bash script any argument, without running into my error checks, checking for input... Here is the code: #!/bin/bash... (7 Replies)
Discussion started by: kidi
7 Replies

3. Shell Programming and Scripting

Beginner here, how to call a bash-script from python properly?

Hi everyone, i have the following foo='lsusb | grep Webcam | cut -c16-18' sudo /home/user/public/usbreset /dev/bus/usb/001/$foo when i try to call this script from python using"", shell=True) it seems that only 'sudo /home/user/public/usbreset' is being... (6 Replies)
Discussion started by: hilfemir
6 Replies

4. Shell Programming and Scripting

Beginner Bash Scripting Question

Hello, I am new to Linux and studying to become a Unix System Admin. I am taking a course in which I was practicing creating a bash script to ping a particular IP address. The script can be found below: #/bin/bash echo "Enter the IP address" read ip if then ping -c 1 $ip if ;... (3 Replies)
Discussion started by: shah9250
3 Replies

5. Red Hat

Help me please i am beginner

i have windows 8 host on Dell Laptop vmware 9 redhat 7.2 iso downloaded through redhat official site after installation on vm it only boots into text dont show graphics Please guide:( (1 Reply)
Discussion started by: hananabbas
1 Replies

6. Shell Programming and Scripting

Bash Script to Ash (busybox) - Beginner

Hi All, I have a script that I wrote on a bash shell, I use it to sort files from a directory into various other directories. I have an variable set, which is an array of strings, I then check each file against the array and if it is in there the script sorts it into the correct folder. But... (5 Replies)
Discussion started by: sgtbobie
5 Replies

7. Shell Programming and Scripting

[Bash] Beginner at scripting

Hi, I'm a beginner at shell scripting, just started scripting in bash a few days ago. I want to test if the command ls *.jpg returns exit code 2, and if yes I want to execute a new command ls *.jpeg, doing a test on it... and pretty much repeat the procedure. Is this correct? #!/bin/bash... (1 Reply)
Discussion started by: Utherr
1 Replies

8. Shell Programming and Scripting

Beginner looking for help

Hello, I am trying to write a script that reads names from a file called input, removes names if they have the same letter next to each other and prints the others. e.g. Colin & John would be printed Garry & Lynn would be removed My thinking is that I read in each name and... (3 Replies)
Discussion started by: colinireland
3 Replies

9. Shell Programming and Scripting

Beginner bash scripting - a few problems

Hey Guys, I am creating a bash script on my freeBSD box, the script should basically ask the user to enter a username and domain. The script will take this information and basically append alot of information to config files so the user can receive email from that domain and create a web site at... (1 Reply)
Discussion started by: traxy
1 Replies

10. UNIX for Dummies Questions & Answers

Beginner Help

hi guys, i have a DEl xps laptop cor 2 duo 2.2 i have vista installed on it i want to install a dual Boot UNIX on it.. can some one guide me ...cause i m tottaly new to UNIX i want to install unix on that laptop along with Vista.... thx any help would be deeply appreciated (sorry if i... (5 Replies)
Discussion started by: Farhan082
5 Replies

Featured Tech Videos