Skip to content

Commit 7f3b565

Browse files
author
Mike Schinkel
committed
Add bash_macros_backup(), bump to 1.0.4
1 parent 8926169 commit 7f3b565

File tree

4 files changed

+26
-4
lines changed

4 files changed

+26
-4
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
11
/macros.sh
2+
/macros.sh.bak

CHANGELOG

+6
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
3434

3535
-->
3636

37+
## [1.0.4] - 2023-01-23
38+
39+
### Added
40+
41+
- Added a bash_macros_backup() command to backup macros.sh to macros.sh.bak.
42+
3743
## [1.0.3] - 2023-01-22
3844

3945
### Added

README.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -53,10 +53,10 @@ You must have [Git](https://git-scm.com/) installed and in your `$PATH`.
5353
From your Bash terminal command line, run this command:
5454

5555
```
56-
source <(curl -sL https://raw.githubusercontent.com/mikeschinkel/bash-macros/v1.0.3/install.sh)
56+
source <(curl -sL https://raw.githubusercontent.com/mikeschinkel/bash-macros/v1.0.4/install.sh)
5757
```
5858

59-
Here is a [**link to the installer**](https://raw.githubusercontent.com/mikeschinkel/bash-macros/v1.0.3/install.sh) for your pre-installation inspection.
59+
Here is a [**link to the installer**](https://raw.githubusercontent.com/mikeschinkel/bash-macros/v1.0.4/install.sh) for your pre-installation inspection.
6060

6161
## To Uninstall
6262

bash-macros.sh

+17-2
Original file line numberDiff line numberDiff line change
@@ -10,21 +10,26 @@ alias mm="bash_macro_move"
1010
alias mc="bash_macros_clear"
1111
alias mr="bash_macros_reload"
1212
alias me="bash_macros_edit"
13+
alias mb="bash_macros_backup"
1314

1415
function bash_macros_aliases() {
1516
echo "ma mh ml ms md mm mc mr"
1617
}
1718

1819
function bash_macros_help() {
20+
local rel_file
21+
rel_file="$(bash_macros_rel_file)"
22+
1923
bash_macros_init
2024
echo "Bash Macros Help:"
2125
echo
2226
echo " - mh — Show (this) Bash Macros help"
2327
echo " - ml — List macros"
2428
echo " - mc — Clear macros"
2529
echo " - me — Edit macros file and reload"
26-
echo " - ms — Save macros to ~/$(bash_macros_rel_file)"
27-
echo " - mr — Reload macros from ~/$(bash_macros_rel_file)"
30+
echo " - ms — Save macros to ~/${rel_file}"
31+
echo " - mb — Backup macros to ~/${rel_file}.bak"
32+
echo " - mr — Reload macros from ~/${rel_file}"
2833
echo " - ma — Add macro from history"
2934
echo " Syntax: ma <macro#> <command>"
3035
echo " Example: ma 3 'git clone $(bash_macros_repo_url)'"
@@ -260,4 +265,14 @@ function bash_macros_edit() {
260265
fi
261266
}
262267

268+
function bash_macros_backup() {
269+
local file
270+
local bak
271+
272+
file="$(bash_macros_filepath)"
273+
bak="${file}.bak"
274+
cp "${file}" "${bak}"
275+
echo "Bash macros backed up to ~/$(bash_macros_rel_file).bak"
276+
}
277+
263278
bash_macros_reload assigned

0 commit comments

Comments
 (0)