Copyright (C) Mainichi Communications Inc. All rights reserved. 掲載記事の無断転載を禁じます
Copyright (C) Mainichi Communications Inc. All rights reserved. 掲載記事の無断転載を禁じます
Windows Power Shell は、 Windows をコマンドラインから、あるいは、 スクリプトを使って管理するために作られた新しいシェル環境です。 作られた目的のせいか、 Power Shell を解説する書籍・ウェブサイトには、 「管理者向けの TIPS、実例集」 (レジストリの値の変え方とか、WMI の呼び出し方とか) みたいな物が多かったりします。 でも、Power Shell を調べてみた感じ、 Power Shell 用のスクリプト言語や、 コマンドレットの動作・作り方など、 プログラミング的にも結構面白そうな感じなので、 その辺りを中心に話をしてみようかと思います。 (注: コマンドの実行結果など、 ページ表示の収まりをよくするため、 ところどころ省略している部分があります。 )
あまり知られていないが、GNUのxargsコマンドには、 プロセスの最大数を設定できるオプションというのが用意されている。 コレを使って、プロセスを並列実行させてみよう。 xargs --max-procs=MAX-PROCS -P MAX-PROCS command MAX-PROCSに数字を指定すると、 最大で、その数だけ command プロセスを生成する。 デフォルトは、1プロセスだけになっている。 いくつか例を交えて説明する。 サンプルとして、以下のようにURLが行ごとに記述されたファイルを元に curlをxargsで並列実行して、HTMLデータを取得してみよう。 $ cat ./url_list.txt http://www.google.co.jp/ http://www.yahoo.co.jp/ http://b.hatena.ne.jp/ まず、普通にxargsを使ってc
複数のファイルの名前を変更する際に、 便利なコマンドというものがある。 いくつかご紹介させていただこう。 カレントディレクトリにあるファイルの名前を、 たとえば、*.html を *.htm と名前を変更するという課題に対し どのぐらいエレガントに書けるかというのを比較してみる。 まず、普通にやったらどうだろう。 おそらく、for文 をつかうことだろう。 for file in *.html do base=`basename $file .html` mv $base.html $base.htm; done; zshだともうちょっとスマートにかけて、 for file in *.html do mv $file:r.html $file:r.html; done; こんな具合。 for文 が嫌いなネット右翼のために、 xargs を使ってこの問題を解いてみよう。 ls -1 *.htm
Microsoftは14日(米国時間)、開発コード名「Monad」で知られるコマンド実行環境「Windows PowerShell 1.0」の無償公開を開始した。サポートされるOSは.NET Framework 2.0がインストールされたWindows XP SP2と2003 SP1、それぞれ32ビット版と64ビット版が提供される。Windows Vista版も同日公開されたが、正式バージョンの1.0ではなく、リリース候補第2版(RC2)という位置付け。 今回のリリースでは、130を超えるコマンドラインツール(コマンドレット)を装備。英語版のほか、日本語版やドイツ語版、フランス語版など各言語にローカライズされたパッケージも提供される。 Windows PowerShellは、従来のコマンドシェル(cmd.exe)に代わるWindows標準のコマンド実行環境。コマンドとパラメータを組み合わせ
私自身が重宝している自作シェルスクリプトを紹介します。 一応「役に立つ」と謳っていますが、ニッチな機能なスクリプトばかりです。実態は「一部の人だけに役に立つスクリプト群」です。 全て自由に使って頂いて結構です。 個々のスクリプトを丸ごと掲載するスタイルの為、ページ全体で重複部分が多くならないように、意識的に書式にバラエティを持たせてあります。たとえば文字列の切り出しはcut,awkのsubstr,bashの機能等、様々な方法を適当に使用しています。 Ubuntuの場合、デフォルトではsh=dashなので"if ["を使っている個所は手直しが必要です。 私の場合は手っ取り早くこのように $ cd /bin ; sudo ln -sf bash sh sh=bashに変更してしまって対応することが多いです。(2010-3-4追記)最近はやらないです。ただし今後作成するものについてはbash専用
ワークプレイスを最適化し、虎ノ門に本社を移転 日本IBMは、2024年1月に、虎ノ門・神谷町エリアに事業所を新設し、そこに本社を移転します。 ニュースリリース watsonx Graniteモデル・シリーズ、IBM watsonxモデル向けお客様保障の提供開始を発表 IBM TechXchange Conference Japan(2023年10月31日~11月1日) 無料評価版:エンタープライズ・グレードのAIモデルを構築 無料評価版:あらゆるデータを対象に、AIワークロードを拡張 SPSS Statisticsの年間サブスクリプション選択で10%割引 ストレージの構成比較から見積までを簡単に
各所で話題ですが、やっぱり便利なのでメモ書きも兼ねてエントリー。 IBMにて「UNIX productivity tips」が紹介されています。いくつかありますが個人的にささったものをご紹介。 » UNIX productivity tips。IBMさんにはいい記事多いですね。 ■ よく使うコマンドを知るべし! 以下のコマンドでhistoryを頻出順に並び替えてくれます。 history|awk '{print $2}'|awk 'BEGIN {FS="|"} {print $1}'|sort|uniq -c|sort -r 僕の場合の結果。 163 ls 115 chmod 82 cd 54 ll 36 exit 35 su 25 vi 21 mkdir 21 less 17 mysql 14 rm 14 crontab 12 /usr/bin/php 10 pwd 9 iconv 7
SED 教室 SEDLEC Release 1.11 Copyright(c)1992-95 by Hiroaki Sengoku sengoku@gcd.org SED は、UNIX, MS-DOS など多くの OS 上で利用可能な非会話型ストリームエ ディタです。高機能である反面、スクリプトが慣れるまでは難しいので、あまり 使われていませんでした。そこで少しでも多くの方に SED のすばらしさを知っ ていただきたいと思い、SED 教室を Nifty Serve FMCN フォーラム 17 番会議室 で開講しました。その第一回目から第十三回目までの内容に加筆訂正を行ったも のがこのパッケージです。 Release 1.00 (平成四年夏) SED 教室 第一回 〜 第十一回 Release 1.11 (平成七年秋) SED 教室 第一回 〜 第十三回 SED 教室パッケージは以下のファイ
Windowsのシェルといえばコマンド・プロンプト(cmd.exe)であるが、その機能はUNIXなどのシェルと比較するとまったく貧弱なものである。WindowsではMMC(Microsoft Management Console)などのGUIによるシステム管理/設定のインターフェイスはリッチだが、運用や管理や自動実行が容易なスクリプトによるインターフェイスは弱い。 これはアプリケーションやサービスの設定がファイル・ベースであるUNIXなどに対して、Windowsがレジストリ・ベースであることも1つの要因だろう。またコマンド・プロンプトの機能を補うために、WSH(VBScriptおよびJScript)やWindows Services for UNIX、あるいはWMI(Windows Management Instrumentation)なども用意されているが、逆にそれらがWindowsのシ
リリース、障害情報などのサービスのお知らせ
最新の人気エントリーの配信
処理を実行中です
j次のブックマーク
k前のブックマーク
lあとで読む
eコメント一覧を開く
oページを開く