シェルスクリプトの変数が空だったら指定の値にする時のTips
シェルスクリプトで変数が空の場合にだけ代入することができる便利な機能がある。
${variable:=value}
$variable
が空の場合のみvalue
が値に入ります。
しかし、実際に入力してみるとcommand not found
になる。
bash-4.3$ ${variable:=value} bash: value: command not found
これはなぜかというと、変数への代入と同時にシェルに対してその値を返すから。
value
という文字をシェルが実行しようとする。
こういう場合は
bash-4.3$ : ${variable:=value}
:
で返り値を無視してやればよいようだ。
related: シェル変数の定義状況に応じて任意の値を返す方法 - Qiita
tmuxで画面分割時に現在のディレクトリを開く
画面分割(と新規window)には初期ディレクトリを指定する-c
オプションが用意されているので、各キーバインディングを-c
オプション付きにbindし直してやると実現できる。
bind '"' split-window -c "#{pane_current_path}" bind % split-window -h -c "#{pane_current_path}" bind c new-window -c "#{pane_current_path}"
source: unix.stackexchange.com
Couldn't find platform family in Info.plist CFBundleSupportedPlatforms or Mach-O LC_VERSION_MIN
iOSアプリをビルドするとき表題のエラーに遭遇したので対処方法をメモしておく.
2016-03-11 19:11:18.514 xcodebuild[60812:3928219] [MT] DVTAssertions: Warning in /Library/Caches/com.apple.xbs/Sources/DVTFrameworks/DVTFrameworks-9544/DVTFoundation/FoundationClassCategories/DVTNSBundleAdditions.m:123 Details: Error Domain=DVTFoundationErrorDomain Code=-1 "Couldn't determine platform family for <TheLib>." UserInfo={NSFilePath=/Users/ka2n/Library/Developer/Xcode/Archives/2016-03-11/Alice 2016-03-11 19.06.10.xcarchive/Products/Applications/Alice.app/Frameworks/AliceUI.framework/<TheLib>.framework.dSYM/Contents/Resources/DWARF/<TheLib>, NSLocalizedDescription=Couldn't determine platform family for <TheLib>., NSLocalizedRecoverySuggestion=None of the available platform families (iOS, OS X, tvOS, and watchOS) matched an LC_VERSION_MIN load command.} Object: <NSBundle> Method: +dvt_platformFamilyForBundleAtPath:error: Thread: <NSThread: 0x7fd630d14b60>{number = 1, name = main} Please file a bug at http://bugreport.apple.com with this warning message and any useful information you can provide. 2016-03-11 19:11:18.514 xcodebuild[60812:3928219] [MT] IDEDistribution: Step failed: <IDEDistributionSummaryStep: 0x7fd633abbf80>: Error Domain=DVTFoundationNSBundleAdditionsErrorDomain Code=1 "Couldn't find platform family in Info.plist CFBundleSupportedPlatforms or Mach-O LC_VERSION_MIN for <TheLib>" UserInfo={NSLocalizedDescription=Couldn't find platform family in Info.plist CFBundleSupportedPlatforms or Mach-O LC_VERSION_MIN for <TheLib>} error: exportArchive: Couldn't find platform family in Info.plist CFBundleSupportedPlatforms or Mach-O LC_VERSION_MIN for <TheLib> Error Domain=DVTFoundationNSBundleAdditionsErrorDomain Code=1 "Couldn't find platform family in Info.plist CFBundleSupportedPlatforms or Mach-O LC_VERSION_MIN for <TheLib>" UserInfo={NSLocalizedDescription=Couldn't find platform family in Info.plist CFBundleSupportedPlatforms or Mach-O LC_VERSION_MIN for <TheLib>} ** EXPORT FAILED ** [19:11:18]: Exit status: 70
Build Phases
> Copy Bundle Resources
にライブラリのdSYMが入っていないかを確認する。 あれば削除。
ちなみに自分の場合、Carthageを使っていて、一部OSX用設定を間違えて適用していたのが原因だった。iOSの場合は/usr/local/bin/carthage copy-frameworks
がその辺を面倒見てくれるようなので不要。
MacのBluetoothから不要な機器を削除する方法
Optionを押しながらメニューバーのBluetoothアイコンを選択する。すると各機器のサブメニューから削除できるようになっている。 なるほどわかりにくい。