-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathScripting Knowledge
More file actions
42 lines (33 loc) · 2.01 KB
/
Scripting Knowledge
File metadata and controls
42 lines (33 loc) · 2.01 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
Load function from external file:
If you are in another path you can't leave:
SCRIPTPATH="$( cd -- "$(dirname "$0")" >/dev/null 2>&1 ; pwd -P )" #at the begin of your script
. "$SCRIPTPATH/./function_functionname.sh"
Example on this: Personal Issues' issue-listing.sh and its function_process_issues.sh
Stage only deleted files with git add: git ls-files --deleted | xargs git add
https://stackoverflow.com/a/45959365/5623661
remove latest commit but keep working tree untouched: git reset HEAD~
| tr -d "#" (remove a character)
| tr -d \" (remove a quote) https://stackoverflow.com/questions/4248905/remove-quotes-with-sed/4249363#comment123363338_4249363
| tr -d \' (remove a quote) https://stackoverflow.com/questions/4248905/remove-quotes-with-sed/4249363#comment123363338_4249363
| tr '\n' ' ' (replace a newline to another character) https://unix.stackexchange.com/a/26798/470623
SCRIPTPATH="$( cd -- "$(dirname "$0")" >/dev/null 2>&1 ; pwd -P )"
cd "$SCRIPTPATH"
all=$(echo -e "" && stat "$file" && echo "IPFS hash: $(ipfs add -q --only-hash "$file")" && echo -e "------------------------------")
printf "$all"
function question_one {
echo "🤾♀️🤾♀️🤾♀️🤾♀️🤾♀️🤾♀️🤾♀️🤾♀️🤾♀️🤾♀️🤾♀️🤾♀️🤾♀️🤾♀️🤾♀️🤾♀️🤾♀️🤾♀️🤾♀️🤾♀️"
}
question_one
if [ "$1" = "--version" ] || [ "$1" = "-v" ]; then
echo -e "$versionshow ($layer layer) - $year"
fi
if [[ "$(xdotool search --name "Welcome to Firedoge")" = "" ]];then (firedoge -new-tab -url file:///usr/lib/floflis/browser/firedoge/defaults/firstpage/index.html &) fi
get extension of the file requested in command
script_name="$(basename "$1")"
if [ "$(echo ${script_name##*.})" = "nu" ]; then
gnome-terminal --tab --title="Nu Script Handler" -- /bin/nu -c "nu $1; exec nu"
else
echo "---- Nu Script Handler ----"
echo "The file you tried to open isn't a nu script."
echo "Nu scripts are .nu files."
fi