PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Saturday, November 5, 2022

[FIXED] how to concatenate a string to a file in a For loop

 November 05, 2022     bash, cat, console, environment-variables, linux     No comments   

Issue

I need to create files for the user with the words "operating system" inside. I have tried in many ways but I can't figure out which is the best way, for now, this way is the "best" (it creates the files but is empty)..

read n
for i in $(seq $n)
do
     "Operating system" > txt_$i
done

Solution

Add an echo or printf.

echo "Operating system" > txt_$i


Answered By - Jetchisel
Answer Checked By - Senaida (PHPFixing Volunteer)
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing