[GH-ISSUE #1299] Question: How to run archivebox command from outside collection directory #801

Closed
opened 2026-03-01 14:46:24 +03:00 by kerem · 1 comment
Owner

Originally created by @h4rk8s on GitHub (Dec 19, 2023).
Original GitHub issue: https://github.com/ArchiveBox/ArchiveBox/issues/1299

I want to have a parameter that can run anywhere, I'm using this method right now, is there a better way?

which archivebox
archivebox () {
	local prev_dir=$(pwd)
	cd "$HOME/Workspace/Archive"
	command archivebox "$@"
	cd "$prev_dir"
}
Originally created by @h4rk8s on GitHub (Dec 19, 2023). Original GitHub issue: https://github.com/ArchiveBox/ArchiveBox/issues/1299 I want to have a parameter that can run anywhere, I'm using this method right now, is there a better way? ```bash which archivebox archivebox () { local prev_dir=$(pwd) cd "$HOME/Workspace/Archive" command archivebox "$@" cd "$prev_dir" } ```
kerem closed this issue 2026-03-01 14:46:24 +03:00
Author
Owner

@pirate commented on GitHub (Dec 19, 2023):

That works, but I think slightly simpler is to use the env command to wrap it: https://www.gnu.org/software/coreutils/manual/html_node/env-invocation.html

env --chdir="$HOME/Workspace/Archive" archivebox ...
# aka
env -C "$HOME/Workspace/Archive" archivebox ...

To make an alias in bash:

alias archivebox='env --chdir="$HOME/Workspace/Archive" archivebox'
<!-- gh-comment-id:1863186010 --> @pirate commented on GitHub (Dec 19, 2023): That works, but I think slightly simpler is to use the `env` command to wrap it: https://www.gnu.org/software/coreutils/manual/html_node/env-invocation.html ```bash env --chdir="$HOME/Workspace/Archive" archivebox ... # aka env -C "$HOME/Workspace/Archive" archivebox ... ``` To make an alias in bash: ```bash alias archivebox='env --chdir="$HOME/Workspace/Archive" archivebox' ```
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/ArchiveBox#801
No description provided.