Home PC Games Linux Windows Database Network Programming Server Mobile  
           
  Home \ Programming \ Shell for loop     - How to add a new resolution VirtualBox (Linux)

- 10 Regulation of painless SQL Schema (Database)

- Red Hat Enterprise Linux 6.4 Configuring VNC Remote Desktop login access (Linux)

- Java Generics Introduction --HashMap summary (Programming)

- SUSE Linux network configuration and firewall configuration (Linux)

- Linux 4.0+ kernel support for hardware switching module (HW Switch Offload) (Linux)

- Json data with double backslashes to a single backslash Json data processing (Programming)

- Use Linux built-in firewall to improve network access control (Linux)

- shell script: a key optimization CentOS system (Linux)

- After VMware CentOS full VM clone the network card is unavailable Solutions (Linux)

- Ubuntu 14.04 to install Blender 2.71 (Linux)

- Gitolite how to import other Git repositories (Server)

- Linux Bash share tips for getting started (Linux)

- C ++ precision performance test function (Programming)

- DVD production using CentOS installation source within the company Yum (Linux)

- Oracle 10g, 11g database silent installation of small differences (Database)

- Joseph Central Java implementation (Programming)

- Linux System Getting Started Tutorial: how to find information on Linux-embedded module (Linux)

- MySQL performance comparison of large amounts of data storage (Database)

- Java Generics (Programming)

 
         
  Shell for loop
     
  Add Date : 2018-11-21      
         
         
         
  Like other programming languages, Shell support for loop.

The general format of the for loop:
for variable in list
do
     command1
     command2
     ...
     commandN
done
List is a sequence of a set of values (numbers, strings, etc.), each of which values are separated by a space. Each time through the loop, it will be next on the list a value is assigned to variable.

in list is optional, if you do not use it, for recycling location command line parameters.

For example, the order of output current list of numbers:

for loop in 1 2 3 4 5
do
     echo "The value is: $ loop"
done

The result:
The value is: 1
The value is: 2
The value is: 3
The value is: 4
The value is: 5

Sequentially outputs a string of characters:

for str in 'This is a string'
do
     echo $ str
done

The result:
This is a string

.bash Display in your home directory file starting with:

#! / Bin / bash
for FILE in $ HOME / .bash *
do
   echo $ FILE
done

The result:
/root/.bash_history
/root/.bash_logout
/root/.bash_profile
/root/.bashrc
     
         
         
         
  More:      
 
- Apache POI Excel Document Processing (Linux)
- MongoDB upgrade to 2.6 (Database)
- Python format string (Programming)
- MySQL master recovery from failure using binlog (Database)
- Increase ssh security service under Linux (Linux)
- Nginx logging client ip (Server)
- The headers for the current running kernel were not found when VirtualBox installation enhancements (Linux)
- To install Gitolite in Ubuntu / Fedora / CentOS (Linux)
- The most common and most effective security settings under linux (Linux)
- Ubuntu 14.04 running ASP.NET Configuration Mono + Jexus (Server)
- Depth understanding of JavaScript new mechanism (Programming)
- VNC configuration detailed analysis under Linux (Linux)
- Linux folder and extract the differential file comparison techniques -rsync Magical (Linux)
- Java memory mechanism Description (Programming)
- Package the Python script file into an executable file (Programming)
- KVM installation under CentOS 5.5 (Linux)
- Nginx caching using the official guide (Server)
- Open Ubuntu system updates (Linux)
- MyCAT read and write separation of MySQL (Database)
- Iptables use examples (Linux)
     
           
     
  CopyRight 2002-2022 newfreesoft.com, All Rights Reserved.