All Questions
19
questions
4
votes
1
answer
73
views
Recursively Copy Dotfiles from Git Repo to New System's Home Directory
I manage my dotfiles in a github repo. The idea would be that I could clone the repo if I ever have to develop on a new system and symlink them to the home ...
2
votes
0
answers
46
views
Outputting a standalone shell script from arguments
I am solving an exercise. Essentially, it's a shell script that takes in file and/or directory arguments and outputs another (standalone) shell script that outputs these files, including any directory ...
2
votes
1
answer
64
views
Making a disk usage breakdown
I'm looking for a better way of doing this code I made. I work for tech support and one of the biggest questions I am asked is: "Hey, how did my disk get so full in my VPS?"
I am aiming for output ...
3
votes
2
answers
849
views
Run 'N' Number of PHP Scripts on shell forever in a loop
My objective is to run some 'N' number of PHP Scripts in cron.
Since these are web scrapers coded in PHP and hits database on my server, each script runs for like 1 hour and they take a lot of CPU ...
3
votes
1
answer
763
views
Bash script to deploy a mongodb cluster on local machine
I recently wrote a small script to deploy a mongodb cluster on a single machine.
The cluster is composed of :
3 configurations server that holds the same informations (they are replicas )
2 shard ...
1
vote
1
answer
2k
views
Java executing rSync shell command with progress display
I basically want to write a simple GUI program to sync to directories using the rsync command. The core part of the code is below. My main question is, do I need to ...
3
votes
1
answer
808
views
Shell script to archive files to AWS S3
This is a simple script that moves files to S3 if they are > 14 days old. It ignores files that are < 14 days old. If the file is successfully synced to AWS S3 then we can remove it from the server....
2
votes
1
answer
65
views
Shell command for the normal program termination of Skype from the command line
Would the following be the right way to do it in your opinion? Can you suggest a better alternative or, if not, is there something that can be done to make the existing version better?
...
2
votes
1
answer
130
views
C main function for POSIX shell
I got a pretty large main function that I want to break up in smaller helper functions. Can you help me suggest what to break out into helper functions? The ...
0
votes
1
answer
51
views
Handle builtin commands
I've written a small C function to handle the builtin commands of a custom shell that I'm writing in C. Is it better to use a switch instead?
...
3
votes
1
answer
117
views
Display the last N lines of a text file with line numbers in reverse order
Do you think the way I'm doing it is fine? Is this the most typical way to do it? Share your thoughts please.
...
4
votes
1
answer
5k
views
FFmpeg command line for showing two videos side by side
Here is command line for playing two videos side by side in sync in FFmpeg (ffplay). It can be useful for comaring videos, for example.
...
2
votes
2
answers
104
views
Split redirecting to multiple files in bash
A function mycommand which runs command and:
Gives me three log-files which are:
*.stdout.log: everything from ...
1
vote
1
answer
90
views
Unix shell script with master and source files
I have a script which is having too many modules. The script is working perfectly, but the only issue is it is taking too much time and I need to reduce the complexity of the script.
I have a source ...
5
votes
1
answer
1k
views
Bash Music Player
I have finally finished creating my first real project. It's just a simple music player that can provides the user with the latest music from any site (as long as it contains MP3 files) he provides ...
4
votes
3
answers
214
views
Removing NULL / empty fields
just wanted to check with you could this be done better:
...
4
votes
1
answer
996
views
List contents of a folder using a shell script and mail the folder
I want to list the contents of a folder and mail the list using a shell script. I Came up with the following script, please let me know if it is okay:
...
2
votes
1
answer
169
views
Bash script to manage multiple Java Development Kits installations
I'm writing a bash script to manage multiple JDKs, the script is very simple, you have to choose a directory when you store all the jdk's, and the script maintain ...
12
votes
3
answers
280
views
Make a directory and change to it
A basic shell function to create a directory and change to it goes like this:
mkcd () { mkdir "$1" && cd "$1"; }
This works well in many cases but breaks ...