diff options
author | June McEnroe <june@causal.agency> | 2018-08-16 18:00:42 -0400 |
---|---|---|
committer | June McEnroe <june@causal.agency> | 2018-08-16 18:00:42 -0400 |
commit | 1750a4cc5e03521fb85932a14d1cf271d27ec1ea (patch) | |
tree | 3aa012b9adf711d9378094ae5d94f8d0b94658f5 | |
parent | Shorten .local ssh names (diff) | |
download | src-1750a4cc5e03521fb85932a14d1cf271d27ec1ea.tar.gz src-1750a4cc5e03521fb85932a14d1cf271d27ec1ea.zip |
Port all scripts to sh
Not hard, but having to escape ( ) inside [ ] had me confused for a bit.
Diffstat (limited to '')
-rwxr-xr-x | link.sh (renamed from link.zsh) | 12 | ||||
-rwxr-xr-x | pdf.sh (renamed from pdf.zsh) | 6 | ||||
-rwxr-xr-x | prune.sh (renamed from prune.zsh) | 4 |
3 files changed, 11 insertions, 11 deletions
diff --git a/link.zsh b/link.sh index a0a9e7aa..0f1f49aa 100755 --- a/link.zsh +++ b/link.sh @@ -1,10 +1,10 @@ -#!/usr/bin/env zsh -set -o errexit -o nounset -o pipefail +#!/bin/sh +set -e -u -if [[ $# -eq 1 ]]; then - linkPath="$1" +if [ $# -eq 1 ]; then + linkPath=$1 filePath="$PWD/home/${linkPath#$HOME/}" - [[ ! -f "$filePath" ]] + [ ! -f "$filePath" ] mkdir -p "$(dirname "$filePath")" mv "$linkPath" "$filePath" fi @@ -13,6 +13,6 @@ find home -type f | while read -r findPath; do filePath="$PWD/$findPath" linkPath="$HOME/${findPath#home/}" mkdir -p "$(dirname "$linkPath")" - [[ ( -f "$linkPath" && -L "$linkPath" ) || ! -f "$linkPath" ]] + [ \( -f "$linkPath" -a -L "$linkPath" \) -o ! -f "$linkPath" ] ln -s -f "$filePath" "$linkPath" done diff --git a/pdf.zsh b/pdf.sh index 25458dfa..90c73de1 100755 --- a/pdf.zsh +++ b/pdf.sh @@ -1,10 +1,10 @@ -#!/usr/bin/env zsh -set -o errexit -o nounset -o pipefail +#!/bin/sh +set -e -u mkdir -p pdf fetch() { - [[ -f "pdf/$1" ]] && return + [ -f "pdf/$1" ] && return curl --silent --show-error --output "pdf/$1" "$2" echo "pdf/$1" } diff --git a/prune.zsh b/prune.sh index db85a9d1..31ab30cf 100755 --- a/prune.zsh +++ b/prune.sh @@ -1,5 +1,5 @@ -#!/usr/bin/env zsh -set -o errexit -o nounset -o pipefail +#!/bin/sh +set -e -u find -L ~ -type l -lname "$PWD/*" | while read -r linkPath; do rm "$linkPath" |