Using makefile check if symlink exists and create if it doesn't

Bash
In a makefile, I need to check if the symlink include/libraries/libxyz.so exists. If not, I want to create one by running ln -s libxyz.so.1 libxyz.so...
1 year ago

A better way to do git clone

Bash
This is lazy programmer request. I would like to create a shell script automate the following process: git clone <remote-repo-url> cd <clon...
1 year ago

unix - count occurrences of character per line/field

Bash
Given a file with data like this (ie stores.dat file) sid|storeNo|latitude|longitude 2tt|1|-28.0372000t0|153.42921670 9|2t|-33tt.85t09t0000|15t1.0327...
1 year ago

How to achieve AJAX(interactive) kind of SEARCH in LINUX to FIND files?

Bash
I am interested in typing a search keyword in the terminal and able to see the output immediately and interactively. That means, like searching in goo...
1 year ago

Fetching colored text

Bash
My .psqlrc has following options \setenv LESS '-iMSx4 -FXR' \setenv PAGER 'less' \pset pager always and psql output which I want to be colored is ...
1 year ago

Command 'find with -exec' within shell script

Bash
The command: find . -name "database.*-10-15.sql.gz" -exec tar -rf backup.1015.sql.tar {} \; works perfect from command line. But if I put it into ...
1 year ago

How to get this init.d script to start at server restart?

Bash
I'm following the directions on installing Redis on a production machine (CentOS using chkconfig). The example script I was given requires the argume...
1 year ago

how do I use the grep --include option for multiple file types?

Bash
When I want to grep all the html files in some directory, I do the following grep --include="*.html" pattern -R /some/path which works well. The pro...
1 year ago

Filter from patterns in file

Bash
I got two csv files, with the following formats: BigFile.csv: 11111,,101010 22222,xxxxxx,202020 33333,yyyyyy,303030 44444,,404040 LittleFile.csv: ...
1 year ago

psql displaying ansi colored text

Bash
My .psqlrc has following options \setenv LESS '-iMSx4 -FXR' \setenv PAGER 'less' \pset pager always and psql output which I want to be colored is ...
1 year ago

Perl expressions in command line - renaming files

Bash
Could anyone explain the occurence of our? ls -1 | grep .ppm | xargs rename -n 's/.*/our $i; if(!$i) { $i=1; } sprintf("%03d.jpg", $i++)/e' I tried...
1 year ago

Command Prompt: Execute Commands from Any Text File (Not Having ".bat" or ".cmd" Extensions)

Bash
I can't find any way to do, for example, the following: cmd.exe /C "script.txt" In other words, I need Command Prompt to (try) to execute file with ...
1 year ago

Bad 'ls' Command Behavior In Custom Simple Shell

Bash
I am having an issue that is just seeming to slip past my knowledge. I am writing a simple shell to learn some systems programming for an internship c...
1 year ago

Possible to change tab completion behavior in fish shell?

Bash
Update: This complaint relates to an old version of fish -- see the below comment from one of the fish developers describing the awesome improvements ...
1 year ago

Shell script returns: run.sh: line 10: SET: command not found

Bash
I'm trying to run a shell script so I can boot up my local version of a Meteor app that I'm working on. I've never used shell scripts before this, but...
1 year ago

Split string into array Shellscript

Bash
How can I split a string into array in shell script? I tried with IFS='delimiter' and it works with loops (for, while) but I need an array from that ...
1 year ago

How do I programmatically input after a prompt with bash script?

Bash
I have to run a bash script bash.sh that starts up a command line tool. That command line tool has a prompt that says Please enter your email: I th...
1 year ago

Convert human readable time range to the related amount of seconds

Bash
I'm trying to figure out how to implement "smart" time parsing as we know it from the shutdowncommand see manpage in one of my own scripts. So how co...
1 year ago

Execute bash and sh file on Mac without writing extension

Bash
I have a .sh file and I want to execute it from shell without writing the extension. What I did: I created a directory and added it to $PATH I gave ...
1 year ago

Can't copy files with "dd"

Bash
I am using this code to copy files between storage folders - File myDir = new File(root + "/Temp/"); myDir.mkdirs(); try { Runtime.getRun...
1 year ago