All Questions
90
questions
1
vote
2
answers
5k
views
How can I delete the content between two tags in a large xml file (>2GB)
The File in Question is XML but I want a Shell Script to remove all the binary (Base64) encoded images that are embedded. The files are generally huge (>2GB).
I want to delete everything between:
&...
0
votes
1
answer
3k
views
zsh completion for all executables in path
I have written a script which itself takes as an argument any arbitrary executable in my $PATH. Is there a way to create a zsh (or bash) completion function such that I would be able to type myFunc ...
1
vote
1
answer
3k
views
Enumerating every other array element in loop
I have a dynamic array with key-pair values and I’d like to enumerate every other value. In this case, just the names in the array. Since I’m not using bash v4, I have been able to use seq to step ...
1
vote
1
answer
964
views
Terminal new window always shows -bash: Searching: command not found
When open terminal, it always shows -bash: Searching: command not found. It does not affect other functions, just each time, even though open a new terminal window, it still pops up at the top of the ...
12
votes
3
answers
33k
views
What is the difference between terminal and bash? [duplicate]
When I open Terminal Window in Mac OS X, I can type bash and hit enter and I will see:
Last login: Fri Feb 20 14:30:56 on ttys000
Korays-MacBook-Pro:~ koraytugay$ bash
bash-3.2$
I can for example ...
1
vote
1
answer
626
views
Removing illegal characters with Automator
I've been trying to write a Mac Automator service to remove illegal characters from filenames.
I have it working, but the solution is a little inelegant and I was wondering if anyone would have a ...
1
vote
1
answer
70
views
Programs for contolling the execution of bash scripts [closed]
Can anyone recommend a GUI based program to control the execution of bash scripts according to time/interval? I'm already familiar with both cron and at and looking for recommended alternatives. A ...
1
vote
1
answer
360
views
How to get different prompt look for root and regular user
My .bash_profile has different styles of prompt for regular user and root but in order it to work the .bash_profile should be reloaded every time I switch users. How can I achieve this?
Can I make ...
8
votes
2
answers
18k
views
Can `ls` be set to only list the first X files/directories?
I'm trying to make a command which only displays the first 30 files when the ls command is invoked. I found this method...
ls | head -30
... but it ends up spitting out the files in one long list, ...
2
votes
2
answers
6k
views
OSX bash command line countdown timer
I found here on superuser the following nice countdown script that I could include in my .bash_profile:
function countdown(){
date1=$((`date +%s` + $1));
while [ "$date1" -ne `date +%s` ];...
0
votes
1
answer
4k
views
socat as argument to ssh: "bash: socat: command not found"
If I ssh into an osx box from a linux box, issuing socat works fine. However, if I give the socat command as argument to ssh it fails. socat was installed in osx using brew. Any idea why this is ...
1
vote
2
answers
3k
views
Move and rename files based on their parent's directory
I have a collection of directories that all contain a particular file that is named the same in all the directories.
dir1/dirA/file.txt
dir1/dirB/file.txt
dir1/dirC/file.txt
....
dir4/dirX/file.txt
...
2
votes
1
answer
4k
views
mac how to run a command in a different tab/window of a terminal
In Windows, I can run any program from the command prompt by typing
c:> start startup.sh
and windows will run the startup.sh in a different command prompt(terminal) window.
How can I do the same ...
1
vote
2
answers
1k
views
What is the sequence of files bash loads to set PATH variable
I want to understand the way PATH variable is set in Linux/Mac. What all files are loaded and in what sequence to set the PATH variable for BASH.
1
vote
2
answers
6k
views
Use alias source with relative path
I want to add an alias file to my project folder to quickly open and edit files in it with a simple shell command.
To make it more portable, I would like to use only relative paths.
I want something ...