meteor 命令檔案shell 解析

2022-04-03 10:58:19 字數 1745 閱讀 9177

#!/bin/bash

set -e

set -u

set -o pipefail # so curl failure triggers the "set -e"

# 設定兩個位址

bootstrap_url=''

meteor_warehouse_dir="$"

if [ ! -x "$meteor_warehouse_dir/meteor" ]; then # 測試目錄

if [ -e "$meteor_warehouse_dir" ]; then

echo "'$meteor_warehouse_dir' exists, but '$meteor_warehouse_dir/meteor' is not executable." 1>&2

echo 1>&2

echo "remove it and try again." 1>&2

exit 1

fi # 發現倉庫路徑 但路徑裡面出現錯誤

# bootstrap .meteor from a tarball. first, figure out our architecture.

uname=$(uname)

if [ "$uname" != "linux" -a "$uname" != "darwin" ] ; then

echo "sorry, this os is not supported yet." 1>&2

exit 1

fi # 系統是否正確

# if you change this, also change host() in tools/archinfo.js

if [ "$uname" = "darwin" ] ; then # osx 系統

if [ "i386" != "$(uname -p)" -o "1" != "$(sysctl -n hw.cpu64bit_capable 2>/dev/null || echo 0)" ] ; then

# can't just test uname -m = x86_64, because snow leopard can

# return other values.

echo "only 64-bit intel processors are supported at this time." 1>&2

exit 1 # osx 一定需要64位

fiarch="x86_64"

elif [ "$uname" = "linux" ] ; then # linux 系統

arch="$(uname -m)"

if [ "$arch" != "i686" -a "$arch" != "x86_64" ] ; then

echo "unsupported architecture: $arch" 1>&2

echo "meteor only supports i686 and x86_64 for now." 1>&2

exit 1 # 32和64都需要

fifi

platform="$_$" # 平台字串

# this returns something like

root_url="$(curl -s --fail $bootstrap_url)" # 判斷是否提供

tarball_url="$/meteor-bootstrap-$.tar.gz" # 工具包位址

exec "$meteor_warehouse_dir/meteor" "$@" # 執行

shell 命令 判斷檔案

shell 命令 if d filename 判斷檔案 a file 如果 file 存在則為真。b file 如果 file 存在且是乙個塊特殊檔案則為真。c file 如果 file 存在且是乙個字特殊檔案則為真。d file 如果 file 存在且是乙個目錄則為真。e file 如果 file...

shell檔案操作相關命令

1,在 opt目錄 下新建乙個資料夾,名字叫new folder,並且把 etc init.d中的所有檔案拷貝到這個資料夾中。sudo cp r etc init.d opt new folder 2,把new foleder分別壓縮為new folder.tar.gz和new foleder.ta...

shell常用檔案操作命令

echo date y m d true financials.logtail n 1 financials.log 賦值給變數 finc flag tail n 1 financials.log sed n 1p financials.log cut d f1 第一行第一列 賦值給變數 finc ...