IFS例子
来源:互联网 发布:c语言中问号的用法 编辑:程序博客网 时间:2024/05/24 01:50
#!/bin/bash
#Description: Illustration of IFS
line="root:x:0:0:root:/root:/bin/bash"
oldIFS=$IFS;
IFS=":"
count=0
for item in $line;
do
[ $count -eq 0 ] && user=$item;
[ $count -eq 6 ] && shell=$item;
let count++
done;
IFS=$oldIFS
echo $user\'s shell is $shell;
The output will be:
root's shell is /bin/bash
#Description: Illustration of IFS
line="root:x:0:0:root:/root:/bin/bash"
oldIFS=$IFS;
IFS=":"
count=0
for item in $line;
do
[ $count -eq 0 ] && user=$item;
[ $count -eq 6 ] && shell=$item;
let count++
done;
IFS=$oldIFS
echo $user\'s shell is $shell;
The output will be:
root's shell is /bin/bash
- IFS例子
- IFS
- $IFS
- IFS
- $IFS
- IFS討論區
- IFS筆記
- IFS Message
- IFS FAQ
- shell IFS
- zt:IFS應用軟體模組Overview
- IFS中声音过程
- IFS应用系统
- IFS开发语言
- IFS系统表
- IFS分隔符
- shell中的IFS变量
- 关于IFS的说明
- VC 的几个str函数
- Microsoft SQL Server 索引碎片整理最佳实践
- HTTP协议的头信息详解
- windows平台lua 5.1.4的build
- as3 下载数据及生成发布页面
- IFS例子
- HTML Learn
- 如何成为一个技术“牛人”
- 使用SQL Server维护计划实现数据库定时自动备份
- INNO SETUP 配置
- 探索C++的秘密之详解extern "C"
- 个人喜欢的网站http://www.w3school.com.cn
- k-means简介
- BM算法图解