shell

What would be the simplest way to deal with a text file using JSP?

First and foremost I should acknowledge that I have no experience at all using Java ServerPages, but I'm positive about achieving this task if you guys help me out a bit since it doesn't seem like something difficult for a seasoned JSP programmer. Anyway the thing is, there's an actual running JSP application within a *NIX box which I s...

What would be the right way to declare an array within a script that will be called by cron?

I've written a Korn Shell script that sets an array the following way: set -A fruits Apple Orange Banana Strawberry but when I'm trying to run it from within cron, it raises the following error: Your "cron" job on myhost /myScript.sh produced the following output: myScript.sh: -A: bad option(s) I've tried many crontab syntax vari...

Visual Studio Shell And F# (invalid license)

Does anyone have any experience with installing the Visual Studio Isolated Shell and using it with F#? It installed successfully, but when I click on the devenv.exe, it opens VS, but gives me the error "Invalid License Data. Reinstall is required". I have done that many times to no avail. Googling for this issue, I find that devenv.ex...

What's the best way to check that environment variables are set in Unix shellscript

I've got a few Unix shell scripts where I need to check that certain environment variables are set before I start doing stuff, so I do this sort of thing: if [ -z "$STATE" ]; then echo "Need to set STATE" exit 1 fi if [ -z "$DEST" ]; then echo "Need to set DEST" exit 1 fi which is a lot of typing. Is there a more el...

Linux web hosting with shell account

Which linux non shared web hosting with shell account access are you using and would recommend? One of the requirements is that it is based on Linux, has access to (root?) shell account so I can install my own version of apache or tomcat or whatever to serve my web application. ...

How to check if a var is a number in UNIX shell

The title says it all - How to check if a variable contains a number in UNIX shell? ...

Console Application

Edit: I don't know what this user originally wanted, and hopefully they'll edit their question to let us know, but otherwise, let's use this question to answer (or give links to) the following common console window issues: How do you capture the output of a console application in your program (for instance, running a build process and...

How to learn work effectively with Unix CLI

Do you know any resources that teach to good habits of working in UNIX command line? EDIT: I don't mean general books about shell or man pages. I mean the things that you can only see watching professionals working with command line. For example when changing frequently between two directories they use "pushd" command, when repeating a...

Bash configuration on Mac OS X 10.4+

When configuring the bash on OSX via ~/.profile it seems to completely ignore it as soon as ~/.bash_profile exists. If this is correct and expected behavior, should I add my extra configuration stuff to ~/.bash_profile as well or use it instead of ~/.profile? Thanks in advance. ...

Unix shell: how to get the last lines of a file except the first 20?

Say I have a file with any number of lines, say, 125. I want to get all the lines except the first n, say, 20. So, I want lines 21-125. Is there a way to do this with with tail/head, or some other tool? ...

trying to capture javac output in bash shell

I'm trying to redirect the java compiler output to a file. I thought it's supposed to be: javac file.java > log.txt or something. Instead, I see all the output on the terminal and nothing in log.txt! Also, if I want to log errors too, do I do javac file.java 2>&1 > log.txt ? ...

Eclipse (pydev): Is it possible to assign a shortcut to send selection to the python console?

Question so easy that fitted in the title :) Eclipse (pydev): Is it possible to assign a shortcut to send selection to the python console? ...

Command line reserved tokens

When building an application with a CLI, it is useful to avoid using tokens that are commonly used for shell features. For example, | is used for piping output of one application to input of the next. Please supply a complete list of tokens that would need to be escaped to be used? As a minimum/summary, for each token, please identify...

How to warn for the use of unset variables in a korn shell script

Is there any way to throw errors or warnings in a korn shell script to prevent the use of unset variables ? Let's assume I have a temporary folder that I want to remove. TEMP_FILES_DIR='/app/myapp/tmp' rm -Rf $TEMP_FILE_DIR #notice the misspelling How to prevent this kind of mistakes before they actually happen? I know the script sh...

How can I get my bash script to work?

My bash script doesn't work the way I want it to: #!/bin/bash total="0" count="0" #FILE="$1" This is the easier way for FILE in $* do # Start processing all processable files while read line do if [[ "$line" =~ ^Total ]]; then tmp=$(echo $line | cut -d':' -f2) count=$(expr $count + 1)...

Script is re-reading arguments

When I supply the script with the argument: hi[123].txt it will do exactly what I want. But if I specify the wildcard character ( hi*.txt ) it will be re-reading some files. I was wondering how to modify this script to fix that silly problem: #!/bin/sh count="0" total="0" FILE="$1" #FILE specification is now $1 Specification.. for F...

Shell Scripting?

Hi, I am not sure what I am to use for this task, but I am guessing it is shell scripting. But I myself am not familiar with what shell scripting is, so I'm not sure how to do it or if it is possible. If you can give me links or advice, that would be great. What I want to do is: Create a file, simple text file EX: param1 (RANDOMVA...

Delay a Shoutcast stream by 12 hours (Linux/bash)

Hey, I am living on the other side of the world from my home (GMT+1 now, GMT+13 is home), and I miss my old terrestrial radio station. It has a Shoutcast stream, and I would like to simply delay it by 12 hours so that it is always available when I want to listen to it, in a way that would make its timezone be synchronised to my timezone...

Clearcase Multi-file rename

I have a large number of files in a ClearCase directory structure, and I need to go through and change all "makefile" to "Makefile". I'm thinking some combination of the find . -name makefile command with an exec flag, but I'm having a hard time coming up with the exec command. The cleartool mv command does not automatically check out th...

Haskell Interactive

I am a bit rusty on my Haskell and am looking to ramp back up. One thing I enjoy from F# is the F# Interactive shell integrated with Visual Studio: I can evaluate virtually anything (including function and class definitions) and use F# as a shell. Is there an equivalent in Haskell? When I use ghci, I cannot evaluate function definitions....