重定向在不同shell下是有区别的
来源:互联网 发布:如何查询服务器端口 编辑:程序博客网 时间:2024/06/05 19:27
试验AUPE里fcntl函数获取文件状态的程序
#include<unistd.h>#include<stdio.h>#include<fcntl.h>#include<errno.h>#include<stdlib.h>#include<string.h>int main(int argc,char**argv){if(argc != 2){perror("error");exit(1);}int flag;int id;id = atoi(argv[1]);flag = fcntl(id,F_GETFL);if(flag == -1){perror("fcntl error");exit(1);}switch(flag & O_ACCMODE){case O_RDONLY:printf("read only\n");break;case O_WRONLY:printf("write only\n");break;case O_RDWR:printf("read write\n");break;default:fputs("invalid access mode\n",stderr);exit(1);}if(flag & O_APPEND){printf(", append");}if(flag & O_NONBLOCK){printf(", nonblock");}putchar('\n');return 0;}
./a.out 5 5<>tmp //bash,ksh下使用文件描述符5打开tmp文件,得到是读写属性
read write
./a.out 5 5<>tmp //csh下则报错,说明csh不行
Missing name for redirect.
0 0
- 重定向在不同shell下是有区别的
- Shell重定向&>file、2>&1、1>&2的区别
- Shell重定向&>file、2>&1、1>&2的区别
- Shell重定向&>file、2>&1、1>&2的区别
- Shell重定向&>file、2>&1、1>&2的区别
- Shell重定向&>file、2>&1、1>&2的区别
- Shell重定向 &>file、2>&1、1>&2的区别
- Shell重定向&>file、2>&1、1>&2的区别
- Shell重定向&>file、2>&1、1>&2的区别
- Shell重定向&>file、2>&1、1>&2的区别
- shell的重定向例子
- shell中流的重定向
- shell的输入输出重定向
- 重定向与请求转发的区别以及在springmvc中重定向的使用
- 转发重定向的区别
- LTE 重定向和切换的不同
- Shell的命令的结果重定向
- Linux Shell 下的输出重定向
- NSArray的sorting排序
- SMARTFORMS生成PDF
- 医疗设备漏费管理系统
- 6.用户态和内核态的区别
- 使用ping命令时让数据包从指定网卡发送出去
- 重定向在不同shell下是有区别的
- poj 1185 状态DP
- ios视频学习笔记2.1 iPhone开发之开发工具安装及介绍
- EXTJS barchart条形图
- pdf转换成word转换器在线怎么用
- USACO Shuttle Puzzle 解题报告
- 使用struts2的标签,将setAttribute里面的内容直接在页面提取
- POJ 2135 Farm Tour | 费用流
- ios正则表达式的使用,用于判断账号及密码