All Questions
11 questions
0
votes
1
answer
88
views
Salesforce dataloader #!/bin/bash script errors mentions .zshrc
I'm trying to run a certain application (Salesforce dataloader v61) on MacOS.
The entry point is a bash script:
#!/bin/bash
DL_INSTALL_ROOT="$(dirname "$(readlink -f "$0")")&...
0
votes
1
answer
655
views
crontab /bin/zsh: can't open input file: test.sh
I am trying to create a crontab to run a script:
* * * * * cd /Users/test3/Desktop/Scripts/backup/ && /bin/zsh test.sh > /tmp/cron-output.log 2>&1
where test.sh is in /Users/test3/...
3
votes
2
answers
2k
views
How can I save a text file with all command line inputs and outputs without saving the ANSI characters?
I am running the latest mac OS and using zshell, and having trouble writing a shell script. I do most of my work from the command line, and wanted to have a bash script automatically save and log all ...
1
vote
1
answer
203
views
How to send output to next input line?
This my snippet alias hst="history 1 -1 | cut -c 8- | uniq | fzf ".
when I run hst
The output is
$ ~ hst
(the output from hst)
$
This is what I want
$ ~ hst
$ (the output from hst)
Example
...
9
votes
3
answers
4k
views
Move files to directory based on extension (zsh, macOS)
I want to have a script to automatically move all files
into a directory structure that I have in place
(it looks like ~/jpg, ~/png, ~/mp3, ~/zip, and so on).
So far, this is almost doing exactly ...
3
votes
1
answer
513
views
Same command sequence produces different results in command-line and script
I'm writing a utility script to help me delete Git branches in zsh. Currently, it looks like this:
git for-each-ref --format="%(refname:short)" refs/heads/ |
while read -r line; do
...
3
votes
1
answer
6k
views
Proper way to trap in zsh script
I'm having trouble getting a trap function in a zsh shell-script to work without exiting the shell. I have a simple countdown timer that I want to be able to interrupt using Ctrl+C, and when I do I ...
10
votes
2
answers
5k
views
zsh: `source` command doesn't reload functions
(This is on MacOS with zsh 5.7.1)
Here is how I load custom functions in zsh:
# Custom functions
fpath=($HOME/.zfunc $fpath)
autoload -Uz mackupbackup
autoload -Uz tac
autoload -Uz airplane
autoload ...
11
votes
1
answer
6k
views
How to use the stdin as a file
I have a command that wants a file as input, but I get the input from the stdin and I don't want to create a temporary file.
I would like to do the following:
#!/bin/bash
osadecompile /dev/stdin <...
0
votes
3
answers
3k
views
My MacOSX terminal doesn't show the current directory
No matter what directory I enter, the terminal always shows me the root directory which is "Nidas-MBP"
Nidas-MBP% cd Projects
Nidas-MBP% ls
09-Selector-Exercise-Starter.zip My Little Form
...
6
votes
1
answer
13k
views
How to export an environment variable from .sh file in zsh? [duplicate]
I have the following shell script
TEST=/foopath
export TEST
It is in a file called test.sh and on which I ran chmod +x test.sh
When I run ./test.sh I expect that I can then execute echo $TEST and ...