Skip to content

Instantly share code, notes, and snippets.

@herezior
herezior / mvpath.sh
Last active April 15, 2026 19:02
Move the files given in arguments to PATH (replace :'~/.mypath'), handle whether or not the file is an executable, if a file as a same name in path, ask if you wan't to replace it. (This is my first contribution ! All feedbacks is welcome ! (Maybe it's a bit overkill but meh !))
#!/bin/bash
for (( i=1; i<=$#; i++ ))
do
if [[ -f ${!i} ]]
then
if [[ ! -x ${!i} ]]
then
echo "File ${!i} is not executable, change the rights (for user)? [y/n]"
read answer