This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Use Gists to store code you would like to remember later on | |
console.log(window); // log the "window" object to the console |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/perl | |
use Getopt::Long; | |
my ($opt_help, $opt_version, $opt_input); | |
my $result = GetOptions( | |
'i|input=s' => \$opt_input, | |
'version' => \$opt_version, | |
'help' => \$opt_help | |
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# This script prints your city name and the CURRENT date | |
# We can create a variable CITY | |
CITY="Norwich" | |
# The variable DATE will be created with the output of the 'date' command | |
DATE=$(date +"%Y-%m-%d") | |
# Finally, we print a string using the variables we declared. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# This script prints a nice message. Note that text after a "#" is ignored | |
# and you can use this to add comments to your scripts. Well, you SHOULD. | |
echo "Hello, world!" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# A simple script counting files in "current" directory. | |
echo -n "You are working in: " | |
pwd | |
echo -n "Files in your current directory: " | |
ls | wc -l |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# A for loop iterates a set of command (between "do" and "done"), | |
# one time for each of the item in a list. In this example we make | |
# a list of three names | |
for FirstName in Andy Brandy Candy; | |
do | |
echo "Hello $FirstName!" | |
# You can type many commands here! |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# A first example of 'for loop' to iterate a set of commands over a list of files | |
SamFilesCount=$(ls *.sam | wc -l); | |
echo "In this directory you have ${SamFilesCount}" | |
for SamFile in *.sam | |
do | |
echo -n "Converting ${SamFile}... " |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# A script listing all .sam files in a directory, proposing the name | |
# for their respective .bam file. | |
for File in *.sam | |
do | |
echo "SAM File: $File" | |
echo "Possible BAM file: ${File/.sam/.bam}" | |
done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# A first example of 'for loop' to iterate a set of commands over a list of files | |
SamFilesCount=$(ls *.sam | wc -l); | |
echo "In this directory you have ${SamFilesCount}" | |
# Loop throught all .sam files (note: won't work if no .sam files are present!) | |
for SamFile in *.sam | |
do |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# A first example of 'for loop' to iterate a set of commands over a list of files | |
SamFilesCount=$(ls *.sam | wc -l); | |
echo "In this directory you have ${SamFilesCount}" | |
# Loop throught all .sam files (note: won't work if no .sam files are present!) | |
for SamFile in *.sam | |
do |
OlderNewer