background preloader

Bash scripting Tutorial

Bash scripting Tutorial

Eclipse RCP Tutorial Building Eclipse RCP applications based on Eclipse 4 Copyright © 2009 , 2010 , 2011 , 2012 , 2013 Lars Vogel Eclipse e4 This tutorial gives an overview about the Eclipse 4 application platform. This tutorial describes the creation of Eclipse 4 based applications, e.g. The Eclipse platform and IDE is released every year. As of 2012 the main Eclipse release carried the major version number 4, e.g. The Eclipse 4 platform is based on a flexible and extendible programming model. 1.2. The major enhancements in Eclipse 4 compared to Eclipse 3.x are the following: An Eclipse application consists of several Eclipse components. This book uses the terms Eclipse based applications, Eclipse application, Eclipse 4 application and Eclipse RCP application interchangeably for referring to an application which is based on the Eclipse 4 framework. If a certain concept refers to Eclipse 3.x, then it is explicitly stated. 2. 2.1. An Eclipse application consists of individual software components. Note 2.2. 2.3.

Shell Scripts - Learn Linux LINUX CLASSES - PROGRAMMING So how do you run this little wonder of technology? In DOS, all you have to do is name a file with a .bat extension and it'll be recognized as an executable file--but not so with Linux. Since Linux attaches no meaning to file extensions, you have to mark the file as executable by using the chmod command, like this: $ chmod +x deltemp The x marks the file as executable; if you list the permissions for the deltemp file afterward, you will see the x in position four, confirming this: $ ls -l deltemp -rwx------ 1 hermie other 55 Feb 19 14:02 deltemp If you want other users to be able to run this script, give them both read and execute permission, like so: $ chmod ugo+rx deltemp $ ls -l deltemp -rwxr-xr-x 1 hermie other 55 Feb 19 14:04 deltemp Now the permissions show that any user can view or execute the deltemp script, but only you can modify it. $ . Note: If the current directory is in the PATH environment variable, you can omit the ./ before the name. . setvar

BASH Programming - Introduction HOW-TO: Conditionals NextPreviousContents 6. Conditionals Conditionals let you decide whether to perform an action or not, this decision is taken by evaluating an expression. 6.1 Dry Theory Conditionals have many forms. Conditionals have other forms such as: if expression then statement1 else statement2. Yet another form of conditionals is: if expression1 then statement1 else if expression2 then statement2 else statement3. A word about syntax: The base for the 'if' constructions in bash is this: if [expression]; then code if 'expression' is true. fi 6.2 Sample: Basic conditional example if .. then #! The code to be executed if the expression within braces is true can be found after the 'then' word and before 'fi' which indicates the end of the conditionally executed code. 6.3 Sample: Basic conditional example if .. then ... else #! 6.4 Sample: Conditionals with variables #!

jcuda.org - Java bindings for CUDA Using expect script in a shell script I wish I could give you some links. I bought the O'Reilly book many years ago and that's how I learned it, and still use the book as reference when I need it. If you are just going to run some regular line commands, here's an example to get you started: Say you have a file with a list of IP address, and want to telnet to each IP address and add a user named user1 and set the user's passwd to "newpassword". You could pass the IP addresses to the script with a loop like the one I used as an example, or use an array, etc.. but say you use a loop like the example above as root, then your expect script would look like: Code: #! Personally, all of my boxes have ssh and keys, so I spawn ssh and have no need to include passwds. As with ksh, csh, perl, etc, there are many ways to accomplish the same task.

Bash by example, Part 2 Let's start with a brief tip on handling command-line arguments, and then look at bash's basic programming constructs. Accepting arguments In the sample program in the introductory article, we used the environment variable "$1", which referred to the first command-line argument. Similarly, you can use "$2", "$3", etc. to refer to the second and third arguments passed to your script. Here's an example: #! The example is self explanatory except for three small details. Sometimes, it's helpful to refer to all command-line arguments at once. Back to top Bash programming constructs If you've programmed in a procedural language like C, Pascal, Python, or Perl, then you're familiar with standard programming constructs like "if" statements, "for" loops, and the like. Conditional love If you've ever programmed any file-related code in C, you know that it requires a significant amount of effort to see if a particular file is newer than another. if [ -z "$myvar" ] then echo "myvar is not defined" fi #! #!

For - Looping commands Conditionally perform a command several times. syntax-FOR-Files FOR %%parameter IN (set) DO command syntax-FOR-Files-Rooted at Path FOR /R [[drive:]path] %%parameter IN (set) DO command syntax-FOR-Folders FOR /D %%parameter IN (folder_set) DO command syntax-FOR-List of numbers FOR /L %%parameter IN (start,step,end) DO command syntax-FOR-File contents FOR /F ["options"] %%parameter IN (filenameset) DO command FOR /F ["options"] %%parameter IN ("Text string to process") DO command syntax-FOR-Command Results FOR /F ["options"] %%parameter IN ('command to process') DO command The operation of the FOR command can be summarised as... Take a set of dataMake a FOR Parameter %%G equal to some part of that dataPerform a command (optionally using the parameter as part of the command).Repeat for each item of data If you are using the FOR command at the command line rather than in a batch program, use just one percent sign: %G instead of %%G. FOR Parameters Examples Nested FOR commands Related:

Bash Bash is the GNU Project's shell. Bash is the Bourne Again SHell. Bash is an sh-compatible shell that incorporates useful features from the Korn shell (ksh) and C shell (csh). It is intended to conform to the IEEE POSIX P1003.2/ISO 9945.2 Shell and Tools standard. The improvements offered by Bash include: Command line editingUnlimited size command historyJob ControlShell Functions and AliasesIndexed arrays of unlimited sizeInteger arithmetic in any base from two to sixty-four The maintainer also has a bash page which includes Frequently-Asked-Questions. Downloading Bash Bash can be found on the main GNU ftp server: (via HTTP) and (via FTP). Documentation Documentation for Bash is available online, as is documentation for most GNU software. Mailing lists To ask for help about bash, bash programming or bash shell scripting please use the <help-bash@gnu.org> mailing list. Getting involved Development Translating Bash Maintainer Licensing

Tutorial Overview Introduction - General information about JCuda General setup - The basic setup for JCuda Basic test - The setup of a minimum JCuda test project Creating kernels - How to create, compile and run CUDA kernels with JCuda Futher information: A detailed article about GPU Computing Using CUDA, Eclipse, and Java with JCuda has been published by Mark Bishop. Introduction CUDA provides two different APIs: The Runtime API and the Driver API. In the original CUDA Runtime API, kernels are defined and compiled together with C files. Of course, the NVCC can not be used to compile a Java program. The JCuda Runtime API is mainly intended for the interaction with the Java bindings of the the CUDA Runtime libraries, like JCublas and JCufft. General setup In order to use JCuda, you need an installation of the CUDA driver and toolkit, which may be obtained from the NVIDIA CUDA download site. Basic test Creating kernels Writing the kernel function. JCudaVectorAddKernel.cu Compiling the kernel

Bash by example, Part 1 Fundamental programming in the Bourne again shell (bash) Daniel RobbinsPublished on March 01, 2000 You might wonder why you ought to learn Bash programming. Well, here are a couple of compelling reasons: You're already running it If you check, you'll probably find that you are running bash right now. You're already using it Not only are you already running bash, but you're actually interacting with bash on a daily basis. Bash confusion Learning bash the wrong way can be a very confusing process. While this may be somewhat disappointing to novices, the standard bash documentation can't be all things to all people, and caters towards those already familiar with shell programming in general. That's where this series comes in. Environment variables Under bash and almost all other shells, the user can define environment variables, which are stored internally as ASCII strings. The standard way to define an environment variable under bash is: Quoting specifics dirname and basename Command substitution

Related: