File tree Expand file tree Collapse file tree 2 files changed +35
-0
lines changed Expand file tree Collapse file tree 2 files changed +35
-0
lines changed Original file line number Diff line number Diff line change @@ -79,6 +79,16 @@ sudo spindump -notarget 60 -o ~/Desktop/spindump.txt
7979sudo dtrace -q -n ' syscall::exec*:entry { printf("%s %s\n", execname, copyinstr(arg0)); }'
8080```
8181
82+ # set -euxo pipefail
83+
84+ well.. for set -e at least... https://news.ycombinator.com/item?id=44666984
85+
86+ ``` sh
87+ trap ' caller 1' ERR
88+ ```
89+
90+ also can add -E as of recently.
91+
8292
8393
8494
Original file line number Diff line number Diff line change @@ -192,6 +192,31 @@ function maxcpu100 -d "literally max out all your cores."
192192 for i in (seq (nproc)); yes > /dev/null & end
193193end
194194
195+ function copy_modification_date -d " Copies the modification time (and access time) of one file to another"
196+ # Check if the correct number of arguments are provided
197+ if test (count $argv ) -ne 2
198+ echo " Usage: cpmodtime <source_file> <target_file>" >&2
199+ echo " Copies the modification time (and access time) from <source_file> to <target_file>." >&2
200+ return 1
201+ end
202+
203+ set -l source_file $argv [1]
204+ set -l target_file $argv [2]
205+
206+ # Check if the source file exists and is a regular file
207+ if not test -f " $source_file "
208+ echo " Error: Source file '$source_file ' does not exist or is not a regular file." >&2
209+ return 1
210+ end
211+
212+ # Use 'touch -r' to copy the timestamps (both modification and access)
213+ touch -r " $source_file " " $target_file "
214+ end
215+
216+
217+
218+
219+
195220# requires my excellent `npm install -g statikk`
196221function server -d ' Start a HTTP server in the current dir, optionally specifying the port'
197222 # arg can either be port number or extra args to statikk
You can’t perform that action at this time.
0 commit comments