Operation | Windows | Unix csh-based (csh, tcsh) | |
---|---|---|---|
initialisation | NT: set to the values in "System Properties/Environment", DOS: set in autoexec.bat | set in /usr/local/env/.cshrc (sometimes /etc/.cshrc), followd by ~user/.login if login shell. | |
I/O redirection | cmd cmd >>out-file-append stderr cannot be redirected, always goes to screen. | dito. | |
filename expansion | ? single char, * any number of any (including the dot at the beginning of filenames). eg dir test*.doc will find all files starting with test and the extention doc. dir test* and dir test*.* are the same. | dito, but * doesn't match a dot when it's the first char in a filename (as such files are used as system ressources.). Mask meta-chars with \. | |
whitespace protection | cmd "with blank" | cmd 'with blank' | |
Process piping | with cmd1 | cmd2 | dito | |
Version | winver | showrev | |
environment setting | set [var=[string]] sets env vars. Note: no space behind =. Without var, all vars are shown on stdout. set vars locally for a skript between setlocal and endlocal . each setlocal must be freed by the endlocal before skript end. | set var = text with mandatory spaces. setenv name text sets and exports variable. set ! (bangs) in text are replaced by incremental numbers. array vars are defined as set var = ( foo bar baz ) | |
path | path=newpath;%path% | set path = ( /bin /usr/bin /usr/local/bin ) path is defined as an arry. | |
directory listing | dir | ls | |
help option | command /h | man command or command --help | |
file identity check | comp | cmp | |
file difference comparison | comp f1 f2 for same sized file (default binary) fc f1 f2for text files. | cmp | |
file length | |||
grepping | find findstr with regexen | grep | |
timing | |||
size check | |||
view users | who -al, whoami, groups | ||
view host | hostname | hostname, showrev | |
view user on remote host | finger usrname@hostname | dito | |
processes | ps -elf | ||
jobs | jobs | ||
rights | chown, chgrp | ||
file attribs | chmod | ||
scheduled execution | at | cron | |
Sortieren | sort | sort | |
Output paging | more use pipeing to page output from other programs, file redir and name expansion to page contents of files. | more | |
html downloading | wget | wget | |
free memory | mem | ||
show text file contents | type f1 [f2 ..] | cat | |
route tracing | tracert | traceroute | |
internet IP-name lookup | nslookup | nslookup | |
show net connections | netstat | ||
ping if computer is on network | ping | ping | |
printing | lpr | lp | |
prompt style | prompt $p$g$p = pfad, $g = > | # superuser, % normal, set prompt = "`hostname`:` pwd`>" | |
variables | args for batches are stored in %1 to %9. environment var contents are accessed like this: %VARNAME% Expansion works here too, i.e %* means a list of all %1 to %9. | $var for normal vars or full arrays, $array[2-4] for array slices, $#array number of elements, $?var if var is defined 1, else 0. | |
executable search path | path without param shows path. entries separated by ;(semicolon). append old path with path newdir;%path% |
Tuesday, June 26, 2007
Shell comparison
curi dari http://www.schacherer.de/frank/tech/tools/shells.html
Monday, June 25, 2007
Mari belajar window batch programs
filename | Batch files end with .BAT there is no magical string like in Un*x batch file commands are case insensitive |
comments | rem at line start is a comment line |
in/output redirection | cmd cmd >>out-file-append stderr cannot be redirected, always goes to screen. |
parameters | %1 to %9 arguments number 1 to 9 given to the batch file %* all arguments given to the batch file (max. 9) |
environment variables | %varname% |
conditions | if [not] "string1" == "string2" command Enclose vars and strings in "". Idiom for empty check: if "%var%" == "" command ("" needed for empty string). if [not] exist filename command if errorlevel 1 would test for any abnormal exit. errorlevel is the number the last program executed returned. The condition is true if the number is >= the errorlevel. Normal exit returns 0. |
logical operators | &&execute only when last prog returned ok ||execute only when last prog returned error |
skript loops | for %% var in ( group ) do command [params] var wird zu jedem in group angegebenen dateinamen, eg for %%f in (*.*) do type %%f |
skript jumps | goto mark The target mark itself has to be prepended with : so NT can skip it during execution. :mark |
skript chaining | call blah.bat calls another batch like a subroutine, i.e. the current batch's execution is resumed after the other one ends. Recursion possible. |
skript messages | echo [on|off][message] @ at line start suppress showing of any single line @echo off showing of any line (including this). Echo with message prints message. |
getting user input for skripts | pause[message] halts until any key pressed. |
... | shift shifts the params in a batch one down, e.g. %9 to %8. %0 is lost and if there were more than 10 params, the current number 11 becomes %9. Example loop with shift :next |
Monday, June 4, 2007
Forgot Windows Administrator password??
find out the solution here...
http://home.eunet.no/~pnordahl/ntpasswd/
http://home.eunet.no/~pnordahl/ntpasswd/
Subscribe to:
Posts (Atom)