From 2769fb38fca115df81725a37e7e003ce9ff576a2 Mon Sep 17 00:00:00 2001 From: Connor Olding Date: Mon, 21 Oct 2013 00:57:26 -0700 Subject: [PATCH] treat mingw.sh as actual script, bash syntax fix --- home/shrc.zsh | 2 +- install.sh | 2 +- home/mingw.sh => sh/mw | 16 +++++++++------- 3 files changed, 11 insertions(+), 9 deletions(-) rename home/mingw.sh => sh/mw (81%) mode change 100644 => 100755 diff --git a/home/shrc.zsh b/home/shrc.zsh index 68a3d24..88e14ba 100644 --- a/home/shrc.zsh +++ b/home/shrc.zsh @@ -66,6 +66,6 @@ alias unwrap='awk '\''BEGIN{RS="\n\n";FS="\n"}{for(i=1;i<=NF;i++)printf "%s ",$i alias picky='{ pacman -Qgq base base-devel | tee -; pacman -Qtnq; } | sort | uniq -u' alias unused='{ pacman -Qt; pacman -Qe | tee -; } | sort | uniq -u' -. ~/mingw.sh +#. ~/mingw.sh . ~/sh/lsf.sh/lsf.sh . ~/sh/z/z.sh diff --git a/install.sh b/install.sh index b03487a..e888f8b 100755 --- a/install.sh +++ b/install.sh @@ -40,7 +40,7 @@ PATH="${PATH:?No existing PATH}:$rc/sh" umask 027 -for f in .bashrc .zshrc shrc.zsh mingw.sh .vimrc .conkyrc .inputrc .screenrc .xinitrc; do +for f in .bashrc .zshrc shrc.zsh .vimrc .conkyrc .inputrc .screenrc .xinitrc; do dotless "$f" r="$rc/home/$REPLY" hardlink "$f" "$r" diff --git a/home/mingw.sh b/sh/mw old mode 100644 new mode 100755 similarity index 81% rename from home/mingw.sh rename to sh/mw index da97258..2007393 --- a/home/mingw.sh +++ b/sh/mw @@ -1,3 +1,4 @@ +#!/usr/bin/env bash mkdir -p ~/opt/mingw _mw_enabled=0 @@ -6,11 +7,11 @@ _mw_bin=~/src/mxe/usr/bin _mw_misc=~/src/mxe/usr/$_mw_host _mw_prefix=~/opt/mingw -declare -A _mw_ +typeset -Ag _mw_ # cryptic math expression errors if not global! _mw_export() { [ -z "$1" ] && return 1 - [ -n "${ZSH_VERSION:-}" ] && _mw_[$1]=${(P)1} || _mw_[$1]="${!1}" + [ -n "${ZSH_VERSION:-}" ] && _mw_[$1]="${(P)1}" || _mw_[$1]="${!1}" export "$1=$2" } @@ -19,8 +20,7 @@ mingw-disable() { _mw_enabled=0 local e= - for e in PATH PREFIX CC CPP CXX CFLAGS CPPFLAGS CXXFLAGS LDFLAGS \ - AR RANLIB RC WINDRES SDL_CFLAGS SDL_LDLIBS; do + for e in PATH PREFIX CC CPP CXX CFLAGS CPPFLAGS CXXFLAGS LDFLAGS AR RANLIB RC WINDRES SDL_CFLAGS SDL_LDLIBS; do export "$e=${_mw_[$e]}" done } @@ -51,9 +51,10 @@ mingw-enable() { mw() { if [ "$#" -eq 1 ]; then - if [ "$1" -eq 1 ] - then; mingw-enable - else; mingw-disable + if [ "$1" -eq 1 ]; then + mingw-enable + else + mingw-disable fi else if [ $_mw_enabled -eq 0 ]; then @@ -65,3 +66,4 @@ mw() { fi fi } +mw $1