Skip to content

Magenaut

  • Home
  • Topics
    • Notes
    • Tutorial
    • Bug fixing
    • Extension
    • Server
  • Q&A
  • Privacy Policy
  • About

for

Why the behavior of while loop and for loop is different?

August 10, 2022 by Magenaut

I am trying to read user and server details from file tempo.txt and then check the disk space usage of the file system on that unix account using another script server_disk_space.sh.But I am not able to figure out why while loop is only working for first line and for loop is working fine.Please help me understand this.

Categories Q&A, Unix & Linux Tags for, input, io-redirection, shell Leave a comment

${!FOO} and zsh

August 10, 2022 by Magenaut

${!FOO} performs a double substitution in bash, meaning it takes the (string) value of FOO and uses it as a variable name.
zsh doesn’t support this feature.

Categories Q&A, Unix & Linux Tags bash, for, variable-substitution, zsh Leave a comment

bash variables in for loop range

August 9, 2022 by Magenaut

I want to print list of numbers from 1 to 100 and I use a for loop like the following: number=100 for num in {1..$number} do echo $num done When I execute the command it only prints {1..100} and not the list of number from 1 to 100. Answers: Thank you for visiting the Q&A … Read more

Categories Q&A, Unix & Linux Tags bash, for Leave a comment

In a bash shell script, writing a for loop that iterates over string values

August 8, 2022 by Magenaut

In bash, I know that it is possible to write a for loop in which some loop control variable i iterates over specified integers. For example, I can write a bash shell script that prints the integers between 1 and 10:

Categories Q&A, Unix & Linux Tags bash, for, shell-script Leave a comment

How do I use a temporary environment variable in a bash for loop?

August 8, 2022 by Magenaut

I want to run YII_ENV=prod yii kw/test ten times. I tried

Categories Q&A, Unix & Linux Tags bash, command-line, for, shell, shell-script Leave a comment

proper way to iterate through contents in a directory

August 7, 2022 by Magenaut

I need to iterate through every file inside a directory. One common way I saw was using the for loop that begins with for file in *; do. However, I realized that it does not include hidden files (files that begin with a “.”). The other obvious way is then do something like for file … Read more

Categories Q&A, Unix & Linux Tags dot-files, for, ls, shell-script, wildcards Leave a comment
  1. michealSmith07 on Is there a way to dynamically refresh the less command?August 21, 2022

    That is a very nice post. I like this post.

  2. anonymous on Fix libwacom9 dependency issue when upgrade DebianJune 27, 2022

    saved my day!! Thanks for the help…

  3. sreedhar on Fix libwacom9 dependency issue when upgrade DebianMay 10, 2022

    Thanks its working

  4. saintnick on Fix libwacom9 dependency issue when upgrade DebianMay 10, 2022

    remove libwacom2 worked for me as well

  5. ranafoul on Fix libwacom9 dependency issue when upgrade DebianApril 22, 2022

    apt remove libwacom2 helped on kali 2022.01. gr8

.net ajax asp.net asp.net-core asp.net-mvc asp.net-mvc-3 asp.net-mvc-4 asp.net-web-api bash c# command-line css custom-post-types custom-taxonomy dataframe dictionary django entity-framework functions gridview html iis javascript jquery json linux list matplotlib numpy pandas php plugin-development plugins posts python python-2.7 python-3.x security shell shell-script sql string vb.net webforms wp-query

© 2026 Magenaut • Built with GeneratePress