×

Loading...
Ad by
  • 最优利率和cashback可以申请特批,好信用好收入offer更好。请点链接扫码加微信咨询,Scotiabank -- Nick Zhang 6478812600。
Ad by
  • 最优利率和cashback可以申请特批,好信用好收入offer更好。请点链接扫码加微信咨询,Scotiabank -- Nick Zhang 6478812600。

这个很少用啊: $! holds the PID of the last command that was executed in the background.

jin@tt:/tmp/BOINC> ls &
[1] 28607
account_lhcathome.cern.ch_lhcathome.xml  get_current_version.xml                 run_client
account_qah.uni-muenster.de.xml          get_project_config.xml                  run_manager
all_projects_list.xml                    global_prefs_override.xml               sched_reply_lhcathome.cern.ch_lhcathome.xml
binstall.sh                              global_prefs.xml                        sched_reply_qah.uni-muenster.de.xml
boinc                                    gui_rpc_auth.cfg                        sched_request_lhcathome.cern.ch_lhcathome.xml
boinc_cmd                                job_log_qah.uni-muenster.de.txt         sched_request_qah.uni-muenster.de.xml
boincmgr                                 locale                                  slots
boincmgr.16x16.png                       lockfile                                statistics_lhcathome.cern.ch_lhcathome.xml
boincmgr.32x32.png                       lookup_account.xml                      statistics_qah.uni-muenster.de.xml
boincmgr.48x48.png                       lookup_website.html                     stderrdae.txt
ca-bundle.crt                            master_lhcathome.cern.ch_lhcathome.xml  stdoutdae.txt
client_state_prev.xml                    master_qah.uni-muenster.de.xml          time_stats_log
client_state.xml                         nohup.out
create_account.xml                       projects
jin@tt:/tmp/BOINC> echo $!
28607
[1]+  Done                    ls $LS_OPTIONS
jin@tt:/tmp/BOINC>
Report

Replies, comments and Discussions:

  • 工作学习 / 学科技术讨论 / Can someone explained a little bit more about "echo $!"? google doesn't return much I guess becoz the special character. THX a lot
    • 这个很少用啊: $! holds the PID of the last command that was executed in the background.
      jin@tt:/tmp/BOINC> ls &
      [1] 28607
      account_lhcathome.cern.ch_lhcathome.xml  get_current_version.xml                 run_client
      account_qah.uni-muenster.de.xml          get_project_config.xml                  run_manager
      all_projects_list.xml                    global_prefs_override.xml               sched_reply_lhcathome.cern.ch_lhcathome.xml
      binstall.sh                              global_prefs.xml                        sched_reply_qah.uni-muenster.de.xml
      boinc                                    gui_rpc_auth.cfg                        sched_request_lhcathome.cern.ch_lhcathome.xml
      boinc_cmd                                job_log_qah.uni-muenster.de.txt         sched_request_qah.uni-muenster.de.xml
      boincmgr                                 locale                                  slots
      boincmgr.16x16.png                       lockfile                                statistics_lhcathome.cern.ch_lhcathome.xml
      boincmgr.32x32.png                       lookup_account.xml                      statistics_qah.uni-muenster.de.xml
      boincmgr.48x48.png                       lookup_website.html                     stderrdae.txt
      ca-bundle.crt                            master_lhcathome.cern.ch_lhcathome.xml  stdoutdae.txt
      client_state_prev.xml                    master_qah.uni-muenster.de.xml          time_stats_log
      client_state.xml                         nohup.out
      create_account.xml                       projects
      jin@tt:/tmp/BOINC> echo $!
      28607
      [1]+  Done                    ls $LS_OPTIONS
      jin@tt:/tmp/BOINC>
      
      • THX. I saw this used in a script to keep some PID run as &. I won't use the script but it's nice to know this :-)