2009年9月アーカイブ

fg コマンド フォアグラウンド ジョブ 実行

 【fg コマンド 構文 】
fg [%jobsid]  

 【fg コマンド オプション 】
%jobsid  フォアグラウンドへ切り替えるコマンドのジョブ番号を指定する
 

 【fg コマンド 説明 】
バックグラウンド bgで実行しているジョブ jobを

フォアグラウンド fgにする場合に使用するコマンドです。

ジョブ番号を省略した場合は

カレント・ジョブ(+のついたジョブ)に切り替える。
 

 【fg コマンド 使用例 】

viをフォアグラウンドへ移行する
jobsコマンドでjobの情報を表示しNoを確認する。
ジョブ番号はjobsコマンドにて確認できる。

[takuan@localhost ~]$ jobs
[1]-  Stopped                 vim tmp.txt
[2]+  Stopped                 find / -name *.txt

[takuan@localhost ~]$ fg %1


 バックグランド bg コマンド についてはこちら。

サーバ構築(ランキング)
export 大域変数 追加

export構文 】
export [-p]  

exportオプション  
-p  現在のシェル内でエクスポートされた変数を表示する
 

export説明  】

 

【export使用例】
変数の表示
[oguraan@localhost ~]$ export -p
declare -x G_BROKEN_FILENAMES="1"
declare -x HISTSIZE="1000"
declare -x HOME="/home/oguraan"
declare -x HOSTNAME="localhost.localdomain"
declare -x INPUTRC="/etc/inputrc"
declare -x LANG="ja_JP.UTF-8"
declare -x LESSOPEN="|/usr/bin/lesspipe.sh %s"
declare -x LOGNAME="oguraan"
省略・・・


       export -p
              The  supplied names are marked for automatic export to the environ-
              ment of subsequently executed commands.  If the -f option is given,
              the  names refer to functions.  If no names are given, or if the -p
              option is supplied, a list of all names that are exported  in  this
              shell  is  printed. 

The -n option causes the export property to be
              removed from each name.  If a variable name is followed  by  =word,
              the  value  of the variable is set to word.  export returns an exit
              status of 0 unless an invalid option is  encountered,  one  of  the
              names  is not a valid shell variable name, or -f is supplied with a
              name that is not a function.

サーバ構築(ランキング)
enable  シェル・コマンド 有効 無効

今日はenableコマンドについてのお勉強です。

enableコマンド構文   】
enable [-a] [-np] コマンド名 

【 enableオプション   】

-a 有効の場合
-n 無効の場合


上記の オプションを付けて
シェル・コマンドの有効の一覧・無効の一覧を表示します。

-n 
シェル・コマンドを無効化・使えなくします。

-p 
現在有効・使用できるシェル・コマンドのリストを表示します。
nオプションと組み合わて-pnオプションでenableコマンドを実行すると
現在無効・使用できないシェル・コマンドのリストを表示する
 

 【enable説明 】
指定したシェル・コマンドのみを有効化する。

また、無効にすることもできる。

enableコマンド自体を無効にすると

実行したシェル内では再び有効にできないので

注意が必要です。



【 enable使用例   】
helpコマンドを無効化する
    [oguraan@localhost ~]$ enable -n help
    [oguraan@localhost ~]$ enable -pn
    enable -n help
    [oguraan@localhost ~]$ help
    -bash: help: command not found
    [oguraan@localhost ~]$ enable -a help
    [oguraan@localhost ~]$ enable -pn
    [oguraan@localhost ~]$ help
    GNU bash, version 3.2.33(1)-release (i386-redhat-linux-gnu)
    These shell commands are defined internally.  Type `help' to see this list.
    Type `help name' to find out more about the function `name'.
    Use `info bash' to find out more about the shell in general.
    Use `man -k' or `info' to find out more about commands not in this list.

    A star (*) next to a name means that the command is disabled.




現在有効なシェル・コマンドの一覧を表示する
    [oguraan@localhost ~]$ enable -p
    enable .
    enable :
    enable [
    enable alias
    enable bg
    enable bind
    enable break

    省略・・・・





       enable [-adnps] [-f filename] [name ...]
              Enable and disable builtin shell  commands.   Disabling  a  builtin
              allows a disk command which has the same name as a shell builtin to
              be executed without specifying a full  pathname,  even  though  the
              shell  normally  searches for builtins before disk commands.  If -n
              is used, each name is disabled; otherwise, names are enabled.   For
              example,  to  use the test binary found via the PATH instead of the
              shell builtin version, run ''enable -n test''.  The -f option means
              to  load  the new builtin command name from shared object filename,
              on systems that support dynamic loading.  The -d option will delete
              a  builtin  previously  loaded  with  -f.  If no name arguments are
              given, or if the -p option is supplied, a list of shell builtins is
              printed.   With no other option arguments, the list consists of all
              enabled shell builtins.  If -n is supplied, only disabled  builtins
              are  printed.   If  -a  is  supplied, the list printed includes all
              builtins, with an indication of whether or not each is enabled.  If
              -s  is  supplied,  the  output  is  restricted to the POSIX special
              builtins.  The return value is 0 unless  a  name  is  not  a  shell
              builtin  or  there  is an error loading a new builtin from a shared
              object.


サーバ構築(ランキング)