2016年12月15日 星期四

cifs mount 選項參數

uid 更改目錄擁有者
dir_mode 更改目錄權限
file_mode 更改檔案權限
username 登入帳號
password 登入密碼

2016年12月14日 星期三

Bash 設定未定義變數值

a="123"
variable=$(( $a == 123 ? 1 : 0 ))
echo $variable

echo b=$b
: ${b:=$(whoami)}
echo b=$b

2016年11月25日 星期五

Linux 一般帳號掛載 cifs

root 權限 編輯 /etc/fstab 加入
//server/share /mnt cifs noauto,user 0 0

一般帳號
export USER=user
mount /mnt
Password:

2016年11月22日 星期二

GOLANG function 回傳不特定類型值

func a(x int) interface{}{
  if x==1 {   return nil  }
  if x==2 {   return  2 }
  return "string"
}

2016年11月17日 星期四

GOLANG Swap

b,c := 2,3

b,c = c,b

GOLANG Template 輸出至字串

var doc bytes.Buffer

t.Execute(&doc, data)
str := doc.String()

2016年11月1日 星期二

自訂 docker image

1.tar --numeric-owner --exclude=/root --exclude=/proc --exclude=/sys -cvf centos6-base.tar /

2.cat centos6-base.tar | docker import - centos6-base

3.docker run -i -t centos6-base cat /etc/redhat-release