All Questions
11 questions
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 ...
1
vote
1
answer
301
views
Creating directory tree based on file name
I have a large number of files with the following structure:
[Lion] 2015 Africa Book.pdf
[Lion] 2015 Africa Magazine.pdf
[Lion] 2016 Africa Book.pdf
[Lion] 2016 Africa Magazine.pdf
[Lion] 2015 Asia ...
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
...
1
vote
4
answers
2k
views
How to rename files with different extensions
Say I have these files:
essay.aux essay.out
essay.dvi essay.pdf
essay.fdb_latexmk essay.tex
essay.fls essay.toc
essay.log ...
4
votes
2
answers
3k
views
Running a program with several parameters using shell script
I have a python program that I run it via command line (Mac OSX) as:
python -W ignore Experiment.py --iterations 10
The file Experiment.py should be run multiple times using different --iterations ...
1
vote
0
answers
46
views
How can I repeat the last command in shell without filling up history? [duplicate]
I'm working on a project that requires compilation for each test run. Every time I want to test it out again I press Up to get the last command and Enter to run it. The issue is that it fills my ...
1
vote
1
answer
1k
views
How to create a short cut for the app to my desktop, instead of using terminal?
How do I access the game file in program files (x86) in script editor to create the shortcut?
I enter this cmd in the terminal:
cd ~/.wine/drive_c/Program\ Files\ \(x86\)/ubisoft/prince\ of\ persia/...
10
votes
3
answers
35k
views
Mac OS X how to verify particular packages are installed
In a BASH script I need to check if gcc, g++, cpp, make, libpng devel, zlib devel, git, Java (including devel files), ant and pkg-config are available on Mac OS X and if not, I need to prompt user to ...
0
votes
1
answer
4k
views
Using the cURL command, how does one fetch stock data which comes back *without* commas and spaces?
What can I add to the below script so that it fetches the stock data and brings it back WITHOUT any commas and spaces? For example GOOG Outstanding shares is 675,000,000.
I desire the output of ...
5
votes
2
answers
1k
views
Make copies of a single directory to multiple directories with different names
I'm trying to replicate a single directory (with sub-directories) to a bunch of new directories based on a list. For example I can:
mkdir Fred Barney Thelma Louise Foo Bar
How would I copy a premade ...