We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 0988856 commit c3ff0c1Copy full SHA for c3ff0c1
1 file changed
functions/re_run.sh
@@ -0,0 +1,27 @@
1
+#!/bin/sh
2
+
3
+# Function: re_run
4
+# Description: refresh and rerun the last bash function
5
+# Usage: re_run [arguments]
6
+# Alias: rr
7
8
+function re_run() {
9
+ # Function implementation goes here
10
+ # Get the last command from history
11
+ local last_command=$(history | tail -n 1 | sed 's/^[[:space:]]*[0-9]*[[:space:]]*//')
12
13
+ # Check if we have a command
14
+ if [ -z "$last_command" ]; then
15
+ echo "No previous command found in history"
16
+ return 1
17
+ fi
18
19
+ # Execute the last command with any additional arguments
20
+ echo "${green}Reloading ...${reset}"
21
+ source ~/.zshrc &&
22
+ echo "${green}Re-running: $last_command $* ${reset}"
23
+ eval "$last_command $*"
24
+}
25
26
+# Create alias
27
+alias rr="re_run"
0 commit comments