首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 操作系统 > UNIXLINUX >

WindowsBatch与LinuxShell比较[变量值来源于文件或命令]

2013-01-26 
WindowsBatch与LinuxShell比较[变量值来自文件或命令]WindowsBatch与LinuxShell比较[变量值来自文件或命令

WindowsBatch与LinuxShell比较[变量值来自文件或命令]

WindowsBatch与LinuxShell比较[变量值来自文件或命令]

<!--<br /><br />Code highlighting produced by Actipro CodeHighlighter (freeware)<br />http://www.CodeHighlighter.com/<br /><br />-->WindowsBatch与LinuxShell比较[变量值来源于文件或命令]@echooff
WindowsBatch与LinuxShell比较[变量值来源于文件或命令]
WindowsBatch与LinuxShell比较[变量值来源于文件或命令]echo get the value from one txt file
WindowsBatch与LinuxShell比较[变量值来源于文件或命令]rem the num.txt file only contains one line "001".
WindowsBatch与LinuxShell比较[变量值来源于文件或命令]
WindowsBatch与LinuxShell比较[变量值来源于文件或命令]echo work well
WindowsBatch与LinuxShell比较[变量值来源于文件或命令]set/p num=<num.txt
WindowsBatch与LinuxShell比较[变量值来源于文件或命令]echo %num%
WindowsBatch与LinuxShell比较[变量值来源于文件或命令]
WindowsBatch与LinuxShell比较[变量值来源于文件或命令]echo doesn't work
WindowsBatch与LinuxShell比较[变量值来源于文件或命令]set num=<num.txt
WindowsBatch与LinuxShell比较[变量值来源于文件或命令]echo %num%
WindowsBatch与LinuxShell比较[变量值来源于文件或命令]type num.txt | set num=
WindowsBatch与LinuxShell比较[变量值来源于文件或命令]echo %num%
WindowsBatch与LinuxShell比较[变量值来源于文件或命令]type num.txt | set/p num=
WindowsBatch与LinuxShell比较[变量值来源于文件或命令]echo %num%
WindowsBatch与LinuxShell比较[变量值来源于文件或命令]set num=(`print num.txt`)
WindowsBatch与LinuxShell比较[变量值来源于文件或命令]echo %num%
WindowsBatch与LinuxShell比较[变量值来源于文件或命令]
WindowsBatch与LinuxShell比较[变量值来源于文件或命令]echo get value from command
WindowsBatch与LinuxShell比较[变量值来源于文件或命令]echo some command work well, such as %time%, %date% WindowsBatch与LinuxShell比较[变量值来源于文件或命令]
WindowsBatch与LinuxShell比较[变量值来源于文件或命令]set bbb=%time%
WindowsBatch与LinuxShell比较[变量值来源于文件或命令]echo %bbb%
WindowsBatch与LinuxShell比较[变量值来源于文件或命令]set aaa=%date%
WindowsBatch与LinuxShell比较[变量值来源于文件或命令]echo %aaa%
WindowsBatch与LinuxShell比较[变量值来源于文件或命令]
WindowsBatch与LinuxShell比较[变量值来源于文件或命令]echo general command doesn't work
WindowsBatch与LinuxShell比较[变量值来源于文件或命令]set ccc=('time/t')
WindowsBatch与LinuxShell比较[变量值来源于文件或命令]echo %ccc%
WindowsBatch与LinuxShell比较[变量值来源于文件或命令]
WindowsBatch与LinuxShell比较[变量值来源于文件或命令]echo one solution is to output the result to txt and then input it
WindowsBatch与LinuxShell比较[变量值来源于文件或命令]time/t > ddd.txt
WindowsBatch与LinuxShell比较[变量值来源于文件或命令]set/p ddd=<ddd.txt
WindowsBatch与LinuxShell比较[变量值来源于文件或命令]echo %ddd%
WindowsBatch与LinuxShell比较[变量值来源于文件或命令]
WindowsBatch与LinuxShell比较[变量值来源于文件或命令]echo specially,in for clause,('time/t') is as one command.
WindowsBatch与LinuxShell比较[变量值来源于文件或命令]echo and if also usesetlocal enabledelayedexpansion, the way also can implement get value from command.
WindowsBatch与LinuxShell比较[变量值来源于文件或命令]setlocal enabledelayedexpansion
WindowsBatch与LinuxShell比较[变量值来源于文件或命令]for/f %%i in ('time/t')do(
WindowsBatch与LinuxShell比较[变量值来源于文件或命令]echo %%i
WindowsBatch与LinuxShell比较[变量值来源于文件或命令]set ti=%%i
WindowsBatch与LinuxShell比较[变量值来源于文件或命令]echo !ti!
WindowsBatch与LinuxShell比较[变量值来源于文件或命令])
WindowsBatch与LinuxShell比较[变量值来源于文件或命令]
WindowsBatch与LinuxShell比较[变量值来源于文件或命令]pause

二 Linux Shell

1)超级简单,只需要使用·command parameters·。

实例:

<!--<br /><br />Code highlighting produced by Actipro CodeHighlighter (freeware)<br />http://www.CodeHighlighter.com/<br /><br />-->#!/bin/sh

ddd=`cat ./ddd.txt`
echo$ddd

d=`date`
echo$d

?

完!

热点排行