update doc
This commit is contained in:
27
doc/FAQ.md
27
doc/FAQ.md
@@ -52,6 +52,33 @@ scripts start with `#!/usr/bin/env bash`.
|
||||
|
||||
---
|
||||
|
||||
**Q: Can I use profile functions in scripts?**
|
||||
|
||||
Yes. The supported way is to source `profile.sh` from a Bash script:
|
||||
```bash
|
||||
#!/usr/bin/env bash
|
||||
source /path/to/profile/profile.sh
|
||||
|
||||
taz -p auto -f lz mydir
|
||||
```
|
||||
You can also source one module directly (for example
|
||||
`profile.d/compress.sh`) if you only need a subset of functions.
|
||||
|
||||
When you source a module directly, profile configuration parsing/loading from
|
||||
`profile.sh` is skipped, so defaults from `profile.conf` are not applied unless
|
||||
your script loads them explicitly.
|
||||
|
||||
`profile.sh` also detects whether the current shell is interactive. In
|
||||
non-interactive shells (typical script execution), interactive-only features
|
||||
are intentionally disabled: prompt setup, aliases, welcome/info messages, and
|
||||
startup update checks are not enabled.
|
||||
|
||||
In all cases, avoid aliases in scripts. Use real commands/functions instead,
|
||||
because alias expansion is interactive-shell oriented and can be disabled or
|
||||
behave differently in non-interactive execution.
|
||||
|
||||
---
|
||||
|
||||
**Q: I set `PROFILE_PATH` but profile still can't find its modules.**
|
||||
|
||||
`PROFILE_PATH` must be exported *before* you source `profile.sh`:
|
||||
|
||||
Reference in New Issue
Block a user