From 598328d43033fdbf78299183854b32e3902cb471 Mon Sep 17 00:00:00 2001 From: SinTan1729 Date: Thu, 30 Jan 2025 19:55:16 -0600 Subject: [PATCH] new: Added open-in-server.sh --- README.md | 2 +- open-in-server.sh | 16 ++++++++++++++++ 2 files changed, 17 insertions(+), 1 deletion(-) create mode 100644 open-in-server.sh diff --git a/README.md b/README.md index 95ed0a8..7df469b 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -![Number of scripts](https://img.shields.io/badge/number_of_scripts-47-blue) +![Number of scripts](https://img.shields.io/badge/number_of_scripts-48-blue) # Random Scripts This repository is for random scripts I wrote mostly for personal use. diff --git a/open-in-server.sh b/open-in-server.sh new file mode 100644 index 0000000..49a3806 --- /dev/null +++ b/open-in-server.sh @@ -0,0 +1,16 @@ +#!/usr/bin/env bash + +# This script opens supported locations in my server by appropriately changing the +# mount locations for it to work over ssh. + +ROOTDIR="$(echo $PWD | cut -d/ -f-2,3)" + +if [ "$ROOTDIR" == "/mnt/server" ]; then + ssh -t server-ts-rsync "cd /mnt/storage/$(echo $PWD | cut -d/ -f4-); fish -l" +elif [[ "$ROOTDIR" == "/tank1/personal" || "$ROOTDIR" == "/tank1/media" ]]; then + ssh -t server-ts-rsync "cd $PWD; fish -l" +else + echo "Unsupported directory." + echo "Only /mnt/server/*, /tank1/* are supported." +fi +