Ȼ/04

Top / Ȼ / 04

Introduction: ɸ, 쥯󡤥ѥ

unix νפʥݥꥷΰĤ

ûñʥץȤ߹碌ʣưԤʤ

ȤΤ롥 ΤλȤߤΰĤɸϤȤǤ쥯󡤥ѥץ饤Ǥ.

ޤŪä򤹤ȡunix Ǥ̾Υץ ɸϡסɸϡסɸ२顼ϡפȤ̤äƤ롥
ƤΡɸϡפҤ桼ͳ椹뤳ȤǤ ˡ֥쥯פ֥ѥץ饤פʤΤǤ롥

ɸϤȤ(쥯󡤥ѥ)ͻ
stdinout.png



ޤΤ褦ˡץ֥ץμ¹Ի˥桼ѤΤǤ롥 ǽҤ٤ݥꥷˤ unix ˤñǽץब 󤢤 ᡤεǽȤ߹碌

ޤǥץߥ󥰤򤷤Τ褦ʡʤ꼫ͳʤȤ
ץߥפǴñ˼¸Ǥ



Ȥ֤׾ unix ˽и롥 ʤΤǡҽ褦.



Standard Input/Output: ɸϤȤϲ

unix Ǥϥץϥͥ롤⤷ ǥץ(ե뵭һ) ȤФեѤƥǡϤԤʤ. Ķ˰¸ʤϤǽȤŪǡ unix ǤϤΤκǽ 3(0 2)Υǥץ̤ʤΤȤƷƤ. 餬ɸϤȤФΤǤꡤΤ褦äƤ.

ɸ(stdin)
ץबѥǡϤ˻Ȥ. ꤷƤʤ硤ǥե(̾üܡ)Ѥ.
ɸ(stdout)
ץबѥǡϤ˻Ȥ. ꤷƤʤ硤ǥե(̾üǥץ쥤)Ѥ.
ɸ२顼(stderr)
ץब顼åѽϤ˻Ȥ. ꤷƤʤ硤ǥե(̾üǥץ쥤)Ѥ.

ɸϤˤǡϤϥץư뤬«ˤʤäƤ.

warning.png ꤷʤȤ(ǥե)ϡ
'' ()ܡ ץ ()ǥץ쥤 ''
ȷҤäƤ롥

Redirection: 쥯


ɸ򲿤ˤ뤫ϥ桼ñѹǤ

˻ȤСƱץνϤեؽϤꡤǥץ쥤ؽϤꡤ Ϥʤäѹ뤳Ȥ֥ץ¦θʤ ԤʤȤǤ.

Ρɸѹ뤳ȡ,ʤɸϤ(I/O)쥯Ȥ.

ǡʲˡְĤΥץФ׶Ūʥ쥯ˡ򼨤.
warning.png ĤΥץϤľܷҤƤޤƱ쥯פ̤ˡ֥ѥץ饤פȸƤФ. ܤϸҤ.

ʸˡˤäƤ鷺˰ۤʤ뤿ᡤʲ sh Ϥ csh ϤȤˤ櫓ƼƤ.
(¿γϡ֤ bash ȤäƤ顤Ȥꤢ sh ϤߤƤФ褤)


¿ɤʬʤȤ, ֻ ǽ񤫤Ƥ3򤷤ƳФǤ⽽ʬ.

How to use the redirection: 쥯Τ ޥ̾θ˰ʲΡ֤ޤʤפĤФ褤

Ϥѹ
sh csh ̣
<␣hogeɸϤ hoge Ȥեѹ
<<␣hoge
ƹ1
ƹ2

ƹԺǸ
hoge
ɸϤǽ hogehoge ޤǤƤѹ.
"Here Document" ǽȤФ*1.


ɸϤѹ
sh csh ̣
>␣hogeɸϤ hoge Ȥեѹ
hoge Ȥե뤬¸ߤʤк졤
¸ߤʤƤϾõƾ񤭤Ƥޤ.
csh Ϥӿ shϤ noclobber ѿ򥻥åȤƤȤϡ
hoge ¸ߤʤХ顼ˤʤ.
(ڤʥե˾񤭤Ƥ򼺤ʤεǽ)
>¦␣hoge>!␣hoge(noclobber ѿ̵뤷) ɸϤ hoge Ȥեѹ.
noclobber ѿ򥻥åȤƤäƤ̵뤷ƶŪ˾񤭤.
>>␣hogeɸϤνϤ hoge ȤեɲäƤ
hoge ¸ߤʤк.
csh Ϥ noclobber ѿ򥻥åȤƤȤϡhoge
¸ߤʤХ顼ˤʤ.
>>!␣hoge(noclobber ѿ̵뤷) ɸϤνϤ hoge ȤեɲäƤ.


ɸ२顼Ϥѹ
sh csh ̣
2>␣hogeɸ२顼Ϥ hoge Ȥեѹ.
ե¸, noclobber ѿȤδطϾ嵭Ʊ.
(ޥ␣>␣hoge )␣>&␣bokeɸϤ hoge Ȥե, ɸ२顼Ϥ boke Ȥե˳ơѹ.
(ɸ२顼Ϥѹ뤳ȤϤǤʤ)
ե¸, noclobber ѿȤδطϾ嵭Ʊ.
>␣hoge␣2>&1>&␣hogeɸϤɸ२顼ϤνϤξȤ hoge Ȥեѹ.
ե¸, noclobber ѿȤδطϾ嵭Ʊ.
>¦␣hoge␣2>&1>&!␣hoge(noclobber ѿ̵뤷) ɸϤɸ२顼ϤνξȤ hoge Ȥեѹ.
noclobber ѿ򥻥åȤƤäƤ̵뤷ƶŪ˾񤭤.
>>␣hoge␣2>&1>>&␣hogeɸϤɸ२顼ϤνϤξ hoge ȤեɲäƤ.
ե¸, noclobber ѿȤδطϾ嵭Ʊ.
>>&!␣hoge(noclobber ѿ̵뤷) ɸϤɸ२顼ϤνξȤ hoge ȤեɲäƤ.



Gnome-Preferences.png 쥯μ

㤨С ls␣-lg η̤äĴ٤Ȥ褦. ϽϷ̤եˤƤƤ顤äĴ٤Τɤ. Ūˤϡ

ls␣-lg␣>␣sample-file

ls ޥɤνsample-file Ȥե˥쥯ȤƤ

ȤС sample-file Ȥ̾Υե ls␣-lg η̤. 顤㤨 less ޥɤȤä less␣sample-file Ȥ

  9756
 -rw-r--r--    1 ot-026fd others          0 May 11 14:32 #.xemacs#
 -rw-r--r--    1 ot-026fd others         36 May 11 14:34 #test.txt#
 drwx--s--x   23 ot-026fd others       2048 May 29 20:52 ./
 drwxr-sr-x   43 root     sys          1024 Apr  8 18:54 ../
 -rw-r--r--    1 ot-026fd others          0 May 11 08:47 .Change2tcsh
 -rw-------    1 ot-026fd others        505 May 28 16:14 .ICEauthority
 drwxr-sr-x    3 ot-026fd others        512 May 24 13:57 .Mathematica/
 -rw-r--r--    1 ot-026fd others      23158 Apr 15 22:56 .RealNetworks_RealMediaSDK_60
 -rw-r--r--    1 ot-026fd others        485 Apr 15 22:56 .RealNetworks_RealPlayer_60
 -rw-r--r--    1 ot-026fd others         92 Apr 15 22:56 .RealNetworks_RealShared_00
 drwxr-sr-x    3 ot-026fd others        512 May  8 14:53 .Wnn6/
 ά

Ȥ褦ˡȤ򤤤ĤǤ֤ⷫä긫뤳ȤǤ.

ˡˤե򥵥˥ꥹȥåפƤߤʡ ȻפäȤ褦.
ȡsort ޥ(Ȥ¤٤)Ȥäơ sample-file ȤΡξ 5 ܤǤ礭¤٤Ф褤.
warning.png ls␣-lg ޥɤη̤βܤ˥ե륵ɽ뤫ϴĶ˰¸ΤǡʬǿƤ¹Ԥ褦

ΥǤϡϤȽϤξ쥯󤹤. 㤨аʲΤ褦ˤФ褤.

sort␣-k␣5␣-nr␣<␣sample-file␣>␣sample-file2

sort ޥɤ sample-file ˡ sample-file2 ˥쥯ȤƤ

С sample-file2 ˾ߤη̤äƤ.



notes.png ½

  1. ˼ƱȤäƤߤ.
  2. ˡƱͤˡǡ ĤΥǥ쥯ȥǥ礭5ĤΥեꥹȥåפˤϤɤ褤ͤ. Ƽºݤ˻Ƥߤ.

Tips of redirection: ФƤʥ쥯 /dev/null

ɽ򸫤Ƥʬ褦ˡ쥯ˤ̾ϥեꤹ.
λunix ¸ߤ̤ʥե /dev/null ˻ȤΤdzФƤ.

Υեϡ֥֥åۡեפȤǤ٤äƤ.

  • ɸ˻ꤹȡֲФƤʤ
  • ɸ˻ꤹȡư߹ǡѲʤ

äơȤäƼΤ褦ʤȤǤ.

(äݤ)ե.
cp␣/dev/null␣ե̾

Ȥȡ(äݤ)ե뤬.
եˡȤƤϡ¾ touch ե̾ ȤȤˡ褯ΤƤ.
warning.png եˤ¾ˤ͡ʤҤͤ줿ˡͤ. ͤƤߤ.

ȤäƤɬפΤʤϤΤƤ뤳ȤǤ(᤯)
㤨С

ޥ␣>␣/dev/null␣ 2>&1     sh Ϥξ

ޥ␣>&␣/dev/null     csh Ϥξ

ȤС ɸϤɸ२顼Ϥξ֥åۡؤȾäƤȤˤʤ.
ʤȤ򤷤ʤ̤Τ? Ȼפ⤷ʤ 줬Τ. 㤨С ֤Хå饦ɤǼ¹ԤƤơνϤʻ䡤 ޥɤ nohup Ǽ¹Ԥ硤 ץη׻®٤ʤɤ¬ꤹ뤿˥ǡνϤ˻֤Ⱥʤɤˤ.

¾ˤ⡤ǥХåʤɤ˥顼Ϥ˽ФȤˤƤơ פʤȤϥ顼 /dev/null ˤƤȤȤǤ.

Pipe: ѥ

Ūˤϡ쥯Ȥ

[ե޲𤷤ץ³]

Program A () ե () Program B



ȤʣΥץϤե޲𤷤ƷҤ롥 ҤʤХեŪ˻ꤹΤ̵̤ʤְ㤤ΤȤǤ⤢롥

ǡ Program A ɸϤ Program B ɸϤľܷҤǤޤˡ unix ˤѰդƤ.
Ʊ쥯ȤǤ֤٤ˡϡ ֥ѥספ⤷ϡ֥ѥץ饤פȸƤФ졤Τ褦˻Ȥ.

ѥפλȤ

sh csh ̣
Program A ␣¦␣ Program BProgram A ɸϤ Program B ɸϤȤϤ.
Program A␣2>&1¦␣Program BProgram A ␣¦&␣ Program BProgram A ɸϤɸ२顼Ϥ Program B ɸϤȤϤ.

warning.png ѥפϹʤʤˤŤͤ뤳ȤǤ!!

Gnome-Preferences.png ѥפμ

㤨С ps␣axu η̤̤ǸȤ褦. ΤޤޤΥޥɤ¹Ԥ, ̤ΥǡϤƲ̾ήƤäƤޤΤϷиƤ. Ȥϡless ޥɤʤɤѤơ̤ɽΤФǤ. ˤ

ps␣axu␣|␣less

ps ޥɤνϤ less ޥɤϤľܥѥפǷҤǤ

ȤФ褤.
ˡη̤ץ̾¤ľȤˤäƸפʡ ȻפäȤ褦. ȡsort ޥɤȤäơη̤¤ľɤ. ˤϤɤ뤫ȤȡѥפȤäơ

ps␣axu␣|␣sort␣-k␣11␣|␣less

ps ޥɤνϤ sort ޥɤϤѥפǷҤ sort ޥɤνϤ less ޥɤϤѥפǷҤǤ(ѥפʻȤäƤ)
warning.png ps ޥɤη̤βܤ˥ץ̾ɽ뤫Ķ˰¸롥ʬǿƤ¹Ԥ褦

ȤС

 sb8015th  8377  0.0  2.8 16700 3660 ?        S       20:38   0:00 (dns helper)
 ot-026fd  8540  0.0  1.0  2384 1380 pts/0    S       21:04   0:00 -csh
 ot-026fd  8559  0.0  1.0  2384 1380 pts/0    R       21:19   0:00 -csh
 ot-026fd  8427  0.0  0.9  1900 1164 pts/0    S       20:48   0:00 -sh
 root      6796  0.4 12.2 41760 15644 ?       S       19:03   0:35 /etc/X11/X -au
 root      1575  0.0  0.3  3180  444 ?        S       14:21   0:00 /usr/bin/gdm -
 root      6797  0.0  1.2  3848 1652 ?        S       19:03   0:00 /usr/bin/gdm -
 sb8015th  8267  0.0  3.0  6712 3848 ?        S       20:38   0:00 /usr/bin/gnome
 sb8015th  8331  0.0  2.6  5304 3352 ?        S       20:38   0:00 /usr/bin/sawfi
 sb8015th  8356  0.9 18.2 31716 23340 ?       S       20:38   0:23 /usr/lib/netsc
 sb8015th  8305  0.0  2.4  5152 3128 ?        S       20:38   0:00 /usr/local/bin
 ά

ʤɤȡץ̾¤̤̾ǰ̤ĸȤΤ.

notes.png ½

  1. ˼ƱȤäƤߤ.
  2. ˡѥפʻȤͤơºݤ˻Ƥߤ.

Useful command tee: ФƤʥޥ tee

쥯ѥפȤȤˡ ֥եˤäƤɡ ̤dzǧʤȤǤʤΤ԰¤ ȤפȻפ.
ʤΤ tee ޥɤǡ ɸϤʣơɸϤȥեξ˽Ϥ׵ǽ.

Gnome-Preferences.png teeμ

ɤȤȤȡ㤨 ls␣-lg η̤ե˼ȤͤƤߤ褦.
κȤΤ ls␣-lg␣>␣file Ǥȡ file Ȥ򸫤ޤǤɤʤäƤ뤫狼ʤ.
tee ޥɤѤơ

ls␣-lg␣|␣tee␣sample-file

ls ޥɤνϤɸϤ˽Фʤ顤ġsample-file ȤեˤϤ

Ȥȡ̤ϲ̤ˤϤĤġ sample-file Ȥ̾Υեˤޤ뤳Ȥˤʤ.
Ť˺ȤԤʤȤϤΥޥɤ˻ȤΤɤ.
warning.png ȲϿƤȤ̣ǻ褦ʤΤ script Ȥޥɤ뤳ȤϾҲѤߤ. ɤȤʤŬڤ˻Ȥʬ褦.


Command substitution: ɤɾ ``

ˤϡޥִȤʵǽ.
ϡޥ ` (Хå, հ) ǰϤʬ ˼¹ԤƤη̤֤ ȤΤǤ.

ˤäơޥɤνϷ̤򤢤ʸΤ褦˰.
ñ˸С̾ʤʬƹԤʤʣԤ˽񤱤롤ȤȤǤ.

Gnome-Preferences.png ɤɾμ(1)

㤨Сtest- Ȥ̾Υեꤿʡ ȻפäȤ褦(ʬϷ4Ȥ).
դˤϡdate ޥɤȤ. ϥץŬ˻ꤹйʷǽϤʥޥɤ.
date␣+%m%d Ȥ 4οηǡַספ.
ǡ

touch␣test-`date␣+%m%d`

date ޥɤνϷ̤ʸȤʤ

Ȥ. ȡޥִˤäơ ֻʬ˼¹Ԥơ̤4ο֤ ᡤtest-0529 ʤɤȤ(äݤ)ե뤬뤳Ȥˤʤ.
warning.png αѤǡ֡Ȥץ kill ñʥޥɡפȤ뤳ȤǤ. 虜虜 ps␣axu ޥɤĴ٤ơ Ȥ餺˺ѤΤdzڤ. ܤϾͤƤߤ褦(grep awk ȤȤ褤).

Gnome-Preferences.png ɤɾμ(2)

⤦äʣͤƤߤ褦. 㤨Сt ǻϤޤե̾ĥե뤬Υǥ쥯ȥˤĤ뤫äȤߤƤ ȻפäȤ褦. ȡls ޥɤ wc ޥ(ñ)Ѥ

ls␣t*␣|␣wc␣-w

ȤСե뤬 3Ĥ 3 Ȥ.
ǡκȤɤԤʤΤǡΥޥɤ alias ʤɤǴñϤǤ褦ˤȤ褦(alias ˤĤƤϤμȤθȾʬǾܺ٤򼨤).


,

alias␣t-num='ls␣t*␣|␣wc␣-w'    sh Ϥξ

alias␣t-num␣'ls␣t*␣|␣wc␣-w'    csh Ϥξ

ϤƤФ褤. Ȥ t-num Ϥ 3 Ȥ 4 Ȥ. ɽʤΤ̣ʤ. ǡecho ޥ(ʸɽ)Ȥ߹碌ơ

alias␣t-num='echo␣"`ls␣t*␣|␣wc␣-w`␣t*␣files␣exist."'

Ȥ(sh Ϥξ). ȡ t-num Ϥ뤿Ӥˡ ޥִˤäơ ֻʬ˼¹Ԥơ̤ο֤

 3 t* files exist.

ʤɤȤ̤ɽ褦ˤʤ.
warning.png 硤ñʣۤʤΤǡѸˤäݤ(^-^).

notes.png ½

  1. tee ޥɤɤɾ˴ؤơ ˼ƱȤäƤߤ.



Customization of the shell: cui ĶΥޥ -濴-

unix ˤϡּͳ٤⤯ϸĿͤμͳˡפȤܻ롥 ΢֤СŬڤռƹԤʤʤȤʤĤȤȤǤ⤢.
ǡˤĤɬ׺Ǿ¤ΤäƤ

Configuration file of the shell: ե

뤪ӥ뤫鵯ư륳ޥɤưΰ˱ƶͿϡ ʲΤ褦ʥեǹԤʤ.

sh series: sh

.bashrc
bash 󥷥Ūˡ׻Ȥ񤯥ե. Ҥ褦 .bash_profile ⤳Υե뤬ɹޤΤ̤Ǥ뤿ᡤ üȥǥեȥޥɵưʳϤΥե˽Ф褤.
˴ؤƤϡ̾ϤΥե򤤤ǺѤ.
.bash_profile
bash ֥󥷥ǡ׻Ȥ񤯥ե. üȥǥեȥޥɵư򤳤ΥեǹԤʤΤѡ. ʳ .bashrc ɹǹԤʤ褦ˤʤäƤΤ.
.profile
sh ϥ붦̤˻Ȥե. sh ϥѤͤϸǤ bash Ȥͤ¿顤 ޤ֤Ϥʤ(^-^).
¾
.profile ѿ ENV ꤷեϡôĶפǤϼưŪɹޤ. εǽȤͤϾʤ.

csh series: csh

.tcshrc
tcsh Ȥ硤ɬɹޤե. Ķˤ餺ɹޤ뤿ᡤ˶̤˻Ȥ򤳤Υե˽. Ūˤϡüȥǥեȥޥɵưʳ򤳤Υե˽फ ĶȽꤹʣ񤯤Ǥ. (ְä񤯤ȡ󤷤ü˥Ȥ줿ꤹȴʤȤˤʤäꤹ)
ĤȤϤ񤷤ȤʬʤϤΥեԽƤǺѤ.
.login
󤷤.(t)cshrc ɹߤθɹޤե. üȥǥեȥޥɵưϤΥե˽Τɤ. ܤȤʬʤϿʤ褤.
.cshrc
csh ϥ붦̤˻Ȥե. .tcshrc ˻Ȥͤ¿.
¾
.tcshrc ʤɤ source ޥɤѤ̥եɹˤ뤳Ȥ¿. Ūˤϡalias ޥɤ̥եˤʤɤ꤬褯.



Setting of shell variables: ѿ: ѿ

뤬ͭ˻ѿ. 뼫ȤưˤѤ.
̾ϾʸǵҤ뤳Ȥ¿.

ʸˡ
̣shcsh
, ѿ̾=set␣ѿ̾=
unset␣ѿ̾
ɽset
$ѿ̾



Shell variables: ɽŪʥѿ

ޥɥѥ(PATH: sh, path: csh )
뤫饳ޥɤưȤˡ ɤΥǥ쥯ȥ꤫õƤΤ˶Ƥ˻Ȥ. Ĥޤꡤpath ꤵƤǥ쥯ȥˤ륳ޥɤϡ ޥ̾ϤǻѤǤ.
褯ʬʤѹʤΤ褤.
ץץ(PS1: sh, prompt: csh )
ץץȤȤϡȤäƤȤ˥ޥϹԤƬʬ˥뤬ɽʸǤ.
Gnome-Preferences.png bash Ǥ㡥㤨С

PS1="(BAsh)\H<\u>\[\033[1;34m\]\w\[\033[0m\] <\!>"

ϤƤߤ褦ץץȤ̤Ѳ롥ϥȤޤͭ ե .bashrc ˵Ҥ source␣.bashrc Ϥ뤫󤹤ΤǤ褤(ξϡϤäͭˤʤ)

ŪˤäƤߤС jman␣bashjman␣tcsh Ȥơ֥ץץȡפ⤷ϡPromptפιܤɤФ褤. ܤ񤤤Ƥ.

ҥȥ(HISTSIZE: sh, history: csh)
뤬(history)äƤޥɤο. ¿ˤƤȤ褤.

顼(ignoreeof, noclobber,noglob )
äߥμ­ˤäȯپʤ٤뤿Ѥ. 饤ޥ˥奢Ĵ٤. 褯ʬʤϤʤΤ褤.



Setting of environment variables: ѿ: Ķѿ

뤫鵯ư륳ޥɤưˤѿ. ĶѿɤѤ뤫ϥޥɤ뤳ȤǤ.
̾ʸǵҤ뤳Ȥ¿.

ʸˡ
̣shcsh
, (ѿȤƺ)
export␣ѿ̾
setenv␣ѿ̾␣
unset␣ѿ̾unsetenv␣ѿ̾
ɽset or envprintenv
$ѿ̾



Environment variables: ɽŪʴĶѿ

ǥ(EDITOR)
ץˤäƤϡǥǥưΤ. ˡɤΥǥưΤ򤳤ѿǤ. ꤷƤʤ vi ưꤹΤǡʬδ줿ǥꤷƤΤ褤.

ڡ(PAGER)
ץˤäƤϡ more less ȤäڡưΤ뤬 κݤˤɤΥڡưΤ򤳤ѿǤ. ܸбƤʤڡܸ줬ɤʤλپ㤬Τǡ ŬڤʥڡꤷƤΤ褤.

(LANG)
ɤθѤƤ뤫ꤹ. ԵΤ褤ץʤФδĶѿ򸫤ŬڤѤƤ. ܸѤʤС Linux FreeBSD Ǥ ja_JP.UTF-8 ja_JP.eucJP ʤɤꤹФ褤.

ü°(TERM, TERMCAP )
ü̾ꤹ. 褯狼ʤɤⲿꤷʤФʤȤ֤ɤޤ줿(^-^) TERM vt100 ꤷƤФȤꤢΤ.

Activation of the configration: եɤ߹

եơθ̤ߤ뤿ˤϤɤ褤?
äȤƤޤ󤹤? ϡִפ

warning.png Ķޥ
δĶ򥫥ޥƤȤˡ ˤʤ긷ߥ򤷤ƤޤǤʤʤ ̾桼ǤϤɤ褦ʤʤ뤳Ȥ롥

ʤʤ褦ˤ褦ˤϡ

  1. (Ҥ) source ޥɤǤäǧ
  2. ޥޤФ˥ȤʤüĤϳݤƤ
  3. Ѥ̤ü(ե)󤷤ƥƥȤ(= ߤü(ե)ϥȤʤ)

ʤɤкˤƤ

source command to read the configration: եɤ߹ߥޥ: source

ե塤ˤαƶߤ뤿 եɤ߹פˤϡ

source␣ե̾

ȤФ褤

warning.png Ǥ sh ϤΥޥɤȤ
.␣ե̾ (ԥꥪɡ, ե̾)
ȤˡȤʤĸߤϤ⤦ˤʤɤ



notes.png ½

  1. ˼ߤʤ顤 .bashrc եԽץץȤǤѹƤߤ.
    warning.png .bashrc ե뤬⤽̵ϡΤ褦ꤷƤԽ补

    cd␣~

    touch␣.bashrc



  2. ;͵ΤԤϤˡΥ饤ޥ˥奢ʤɤ򻲹ͤˤƤꤷƤߤ.

Alias: ꥢ

ꥢ(alias) Ȥϡޥɤˡ̾פĤ뵡ǽǤ. (Ǥ sh ˤϤεǽϤʤ)̾ΥˤϤƤĤƤꡤñʤ

ʲϤʤ٤ bash ǽ񤤤Ƥ.

Gnome-Preferences.png alias λ:

ԥ󥰤μ֤򸺤餷ߥ򾯤ʤ
) alias␣md='mkdir'
) alias␣em='xemacs'

ʣư 1ޥɤṳ̂(ޥɤ)
) alias␣newfile='touch␣dummy-`date␣+%m%d`'
csh ϤΤ) alias␣printfile␣'a2ps␣\!*␣|␣lpr'

ޥɤΥץꤹʤɤơǥեưѹ
) alias␣cp='cp␣-i'
) alias␣mv='mv␣-i'
) alias␣rm='rm␣-i'
) alias␣man='jman'
) alias␣ls='ls␣--color=auto␣-Fga'

ѿꤹ
) alias␣newpath='PATH=hogehoge'

Syntax for aliases: ꥢѤ뤿ʸˡ

ꥢñȤǹͤȡѤ뤳ȤǤ csh ϤΥǤ뤬 sh ϤΥΡִؿפȤȤߤѤеǽŪˤϤۤƱȤäƤ褤.

ɤˤ衤ȤǽߤΤǤ 륹ץȤȤ֤ȤޤѤʤ ʤäˤɤΥ뤬褤Ȥ̤Ϥʤ(csh ϥǥ륹ץȤȤ٤ǤϤʤȤήɤ⤤).

Syntax for aliases (sh): ꥢʸˡ: sh

alias␣̾='ޥ'

ϻȤʤ
(ޤǤ sh ˤϤεǽϤʤ)

unalias␣̾

ɽ
alias

ؿ
Ȥ˻Ȥ
ؿ̾(){
ơ ;
ơ ;
}

n ܤΰ $n ȤƻȤǤ.



Syntax for aliases (csh): ꥢʸˡ: csh

alias␣̾␣'ޥ'
csh Ϥξ硤򼡤Τ褦ˤ alias ˴ޤ뤳ȤǤ.
̣
Ƥΰ\!*
Ǹΰ\!$
nܤΰ\!:n


unalias␣̾

ɽ
alias



notes.png ½

  1. ˼ alias ƤߤơʤΤꤻ.

  2. (;͵) alias ʤϴؿǽѤơ ν֤դˤɽ륳ޥ swap Ѱդ.
    Ĥޤꡤ swap␣a␣b Ϥȡ b␣a ɽ褦 alias ⤷ϴؿ swap ¸ƤߤȤȤǤ.

Configration of terminals: ü

˽ФƤ TERM, TERMCAP ȤäĶѿ䤽हΤꤹ. bash ʤ .bash_profile եǡ csh ϥʤ .login եǹԤʤΤɤ.
warning.png Ǥϡ̾桼üԤʤɬϤޤʤ ѹƥȥ֥뤳Ȥ¿Τǡ äɬפʤüϤʤ褤.

Хǥ()ѤȤϡ bash tcsh Τ褦ʿΥǤϷ빽ˡѰդƤΤǥ. bash Ǥ .inputrc Ȥեˤ٤ tcsh Ǥ bind ޥɤȤä .tcshrc եǤ٤ԤʤФ褤. ܤϥ饤ޥ˥奢ʤɤĴ٤뤳.



Commands launched on login: ǥեȥޥɵư

bash ʤ .bash_profile , csh Ϥʤ .login ǡ˵ư륳ޥɤ񤤤Ƥ ȤȤǤ.
򤦤ޤȤäơ㤨еư

  1. ǥ(ʬ)̤Ĵ٤.
  2. ᡼뤬Ƥ뤫Ĵ٤.
  3. αꤦ(^-^).
  4. ؤΥޥ˥󤷤Ƥ뤫Ĵ٤.
  5. ʤȤʤŻɽ(ToT)

ʤɤȤȤǤ(ޤϤʤˤ꤬ʤ).



notes.png ½

  1. 󤹤뤿Ӥˡ
    You use *** KB in this system.
    Ȥǥǥ̤ɽ褦ˤ.
    ʤdu ȤޥɤȤɤ. ץϿŤꤷ褦

Report: ݡ

ʲβˤĤǽ¤긭ĴȹͻԤ
AppliedMath7-Report-04
Ȥ̾Ĥ e-mail ˤƶ˥ݡȤȤФ. ʤݡȤ e-mail TeX Ǻ̤ˤФƤ褤.

Exercises:

  1. ܻμ½ʬ򤹤٤ƹԤˤĤơ֤ȡ𤻤(ޤʤɤȤΤϥ)
  2. ѥפȤ߹碌ƾ˻ȤʥޥɤҲ𤻤补
  3. Υץץˤʤ褦ˡꤻ补
  4. ֺ񤯤˥ǥưפȤޥɤѰդ.
    ŪˤϡդĤƥȥե򥨥ǥ ȸ٤Ǥ褤.

about Icons, ClipArts

For details, see JNorth_arrow-right-sm.png this.


*1 ʤΤʤ¿βǤϤ Here-Document ǽ˿ƤʤȤ¿

źեե: filestdinout.png 15 [ܺ]