端末に貼り付けて、順番に実行したいコマンドのリストがあります。
最初はうまくいきましたが、コマンドは切り捨てられました。
コマンド例:
ogr2ogr -nlt PROMOTE_TO_MULTI -progress -skipfailures -overwrite -lco PRECISION=no -f PostgreSQL PG:"dbname='natural_earth' host='localhost' port='5432' user='natural_earth' password='natural_earth'" 50m_physical/ne_50m_lakes.shp
これらのコマンドのうち約150個があり、改行文字がオフの状態でgeditに保存され、端末にブロックとして直接貼り付けられます。
予想される結果:
$ ogr2ogr -nlt PROMOTE_TO_MULTI -progress -skipfailures -overwrite -lco PRECISION=no -f PostgreSQL PG:"dbname='natural_earth' host='localhost' port='5432' user='natural_earth' password='natural_earth'" 50m_physical/ne_50m_lakes.shp
0...10...20...30...40...50...60...70...80...90...100 - done.
これは最初の30のコマンドに対して機能し、それ以降はコマンドの切り捨てレベルが異なります。たとえば、次のようになります。
$ ogr2o
ogr2o: command not found
$ ogr
ogr: command not found
$ ogr2ogr -nlt PROMOTE_TO_MULTI -progress -skipfailures -overwrite -lco PRECISION=no -f PostgreSQL PG:"dbname='natural_earth' host='localhost' port='5432' user='natural_earth' password='natural_earth'" 50m_physical/ne_50m_graticules_all/ne_50m_grati
FAILURE:
Unable to open datasource `50m_physical/ne_50m_graticules_all/ne_50m_grati'
だから私はLinuxに初めて触れました。 geditからコピーして貼り付けるよりも実行するより良い方法があるかどうか疑問に思います。
私はLinux Mint 15 "olivia" Cinnamon 32ビットを実行しています。
ベストアンサー1
実行したいコマンドを特別なファイルに入れ、シェルスクリプトとして実行します。引数を使用してシェルを呼び出すと、次のようになります。
sh your_commands
または、コマンドの前に追加します。ハッシュボーンそしてファイルを実行可能としてマークしますchmod a+x your_commands
。
#!/bin/sh
your commands
go
here
これにより、通常のバイナリのように動作し、次を実行できます。
/path/to/your_commands
source
あるいは、現在のシェル内のファイルからコマンドを実行するシェルの機能を使用できます(上記の2つのシェルが実行するアクションである新しいシェルを作成する代わりに)。
source your_commands
または
. your_commands
(どちらも同じ意味です。)