A small program written to be read and executed by a command interpreter or another scripting language.
44
votes
5answers
17k views
How exactly does <script defer=“defer”> work?
I have a few <script> elements, and the code in some of them depend on code in other <script> elements. I saw the defer attribute can come in handy here as it allows code blocks to be ...
40
votes
10answers
13k views
How to require commit messages in VisualSVN server?
We've got VisualSVN Server set up as our Subversion server on Windows, and we use Ankhsvn + TortoiseSVN as clients on our workstations.
How can you configure the server to require commit messages to ...
37
votes
4answers
9k views
What is x-tmpl?
Was looking for the answer on the net, but couldn't find anything. This little snack of code really frustrates me, as I can't understand it. (It's part of the plugin called: jQuery File Upload)
...
29
votes
8answers
10k views
Auto increment version code in Android app
is there a way to auto-increment the version code each time you build an Android application in Eclipse?
According to http://developer.android.com/guide/publishing/versioning.html, you have to ...
27
votes
4answers
9k views
Bash : iterate over list of files with spaces
I want to iterate over a list of files. This list is the result of a find command, so I came up with:
getlist() {
for f in $(find . -iname "foo*")
do
echo "File found: $f"
# do something ...
27
votes
3answers
4k views
Command substitution: backticks or dollar sign / paren enclosed?
What's the preferred way to do command substitution in bash?
I've always done it like this:
echo "Hello, `whoami`."
But recently, I've often seen it written like this:
echo "Hello, $(whoami)."
...
26
votes
2answers
24k views
Pseudo-terminal will not be allocated because stdin is not a terminal
I am trying to write a shell scipt that creates some directories on a remote server and then uses scp to copy files from my local machine onto the remote. Here's what I have so far:
ssh -t ...
25
votes
2answers
7k views
install mysql on ubuntu without password prompt
how to write a script to install mysql server on ubuntu?.
sudo apt-get install mysql will install and ask for password for this how to assing password in script.
#!/bin/bash
sudo apt-get install ...
25
votes
6answers
25k views
Check if a file exists with wildcard in shell script
I'm trying to check if a file exists, but with a wildcard. Here is my example:
if [ -f "xorg-x11-fonts*" ]; then
printf "BLAH"
fi
I have also tried it without the double quotes.
24
votes
4answers
49k views
How can I add numbers in a bash script
I have this bash script and I had a problem in line 16.
How can I take the previous result of line 15 and add
it to the variable in line 16?
#!/bin/bash
num=0
metab=0
for ((i=1; i<=2; i++)); do ...
24
votes
5answers
34k views
Using time command in bash script
I'd like to use the time command in a bash script to calculate the elapsed time of the script and write that to a log file. I only need the real time, not the user and sys. Also need it in a decent ...
24
votes
5answers
4k views
Is the 'type' attribute necessary for <script> tags?
I've seen both this:
<script src='http://ajax.googleapis.com/ajax/libs/jquery/1.4/jquery.min.js'></script>
and this:
<script type='text/javascript' ...
23
votes
3answers
10k views
“find: paths must precede expression:” How do I specify a recursive search that also finds files in the current directory?
I am having a hard time getting find to look for matches in the current directory as well as its subdirectories.
When I run find *test.c it only gives me the matches in the current directory. (does ...
21
votes
1answer
14k views
Export from sqlite to csv using shell script
I'm making a shell script to export a sqlite query to a csv file, just like this:
#!/bin/bash
./bin/sqlite3 ./sys/xserve_sqlite.db ".headers on"
./bin/sqlite3 ./sys/xserve_sqlite.db ".mode csv"
...
18
votes
4answers
4k views
How can I check in a bash script if my local git repo has changes or not
there are some scripts that do not work correctly if they check for changes.
I tried it like this:
VN=$(git describe --abbrev=7 HEAD 2>/dev/null)
git update-index -q --refresh
...