scripts: added 'cmd.sh'

This commit is contained in:
Valerie Wolfe 2024-08-22 09:27:15 -04:00
parent 45ad9ea79a
commit 0ef8aa01e7
3 changed files with 23 additions and 0 deletions

View file

@ -39,6 +39,7 @@ A feature-barren DOS clone of `ls` that hides Windows hidden files. Relies on
## Scripts ## Scripts
- `cmd.sh`: Simple wrapper for `cmd.exe`.
- `dos.sh`: Simple wrapper for executing Windows commands directly. - `dos.sh`: Simple wrapper for executing Windows commands directly.
- `elevate.sh`: Elevate WSL (`-l`) or Windows (`-w`) commands from WSL. - `elevate.sh`: Elevate WSL (`-l`) or Windows (`-w`) commands from WSL.
- `explorer.sh`: Launch explorer from WSL. - `explorer.sh`: Launch explorer from WSL.

21
scripts/cmd.sh Executable file
View file

@ -0,0 +1,21 @@
#!/usr/bin/bash
if [ "$#" -eq 0 ]; then
args=''
for arg in $@; do
if [[ $arg =~ ^-.+$ ]]; then
transform=(${arg//-//})
if [[ $arg =~ ^-.+=.+$ ]]; then
transform=(${transform//=/:})
fi
args="$args $transform"
else
args="$args $arg"
fi
done
/mnt/c/Windows/System32/cmd.exe $args
else
/mnt/c/Windows/System32/cmd.exe
fi

View file

@ -2,6 +2,7 @@
alias i := install alias i := install
install DIR="~/.bin": install DIR="~/.bin":
cp cmd.sh {{DIR}}/cmd
cp dos.sh {{DIR}}/dos cp dos.sh {{DIR}}/dos
cp elevate.sh {{DIR}}/elevate cp elevate.sh {{DIR}}/elevate
cp explorer.sh {{DIR}}/explorer cp explorer.sh {{DIR}}/explorer