From 941f9fb60367daa10020590112a49a6bc93c7be5 Mon Sep 17 00:00:00 2001 From: "martin f. krafft" Date: Sat, 28 Mar 2020 08:08:08 +1300 Subject: [PATCH] do not conflict with which command --- .bin/tmux | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.bin/tmux b/.bin/tmux index 577b746..38243a3 100755 --- a/.bin/tmux +++ b/.bin/tmux @@ -44,13 +44,13 @@ fi # only without argument create a new session with a random name/id to which we # can then attach -which() { command -v "$@" >/dev/null;} +hascmd() { command -v "$@" >/dev/null;} -if which uuid; then alias uuidgen=uuid -elif which uuidgen; then : -elif which python3; then +if hascmd uuid; then alias uuidgen=uuid +elif hascmd uuidgen; then : +elif hascmd python3; then uuidgen() { python3 -c 'import uuid; print(uuid.uuid1())'; } -elif which python; then +elif hascmd python; then uuidgen() { python -c 'import uuid; print(uuid.uuid1())'; } else uuidgen() { dd if=/dev/urandom bs=16 count=1 status=none | base64; } -- 2.39.2