shell

How do you determine if there is an error when using the VB.Net Shell Command?

I'm using a VB.net process to shell another exe process (which will wait until completion before processing is continued in the main app); however, I need to know if there is an error in the shelled exe process before continuing in the main app. Is there a way to do this? ...

Trouble with piping through sed

I am having trouble piping through sed. Once I have piped output to sed, I cannot pipe the output of sed elsewhere. wget -r -nv http://127.0.0.1:3000/test.html Outputs: 2010-03-12 04:41:48 URL:http://127.0.0.1:3000/test.html [99/99] -> "127.0.0.1:3000/test.html" [1] 2010-03-12 04:41:48 URL:http://127.0.0.1:3000/robots.txt [83/83] -> ...

How to create mysql database from shell command?

I'm looking for something like createdb in psql or any other solution that would allow me to create databse with a help of a shell command. Any hints? ...

Change present working directory of a calling shell from a ruby script

I'm writing a simple ruby sandbox command-line utility to copy and unzip directories from a remote filesystem to a local scratch directory in order to unzip them and let users edit the files. I'm using Dir.mktmpdir as the default scratch directory, which gives a really ugly path (for example: /var/folders/zz/zzzivhrRnAmviuee+++1vE+++yo...

Why do people write #!/usr/bin/env python on the first line of a Python script?

It seems to me like the files run the same without that line. ...

New Application Process from Bash Shell

I'm relearning UNIX commands to use git on windows using MINGW32. When I launch a program, for example "$ notepad hello.txt" I can't use the shell again until I close the notepad file or CTRL-C in the shell. How do I essentially fork a new process so I can use both programs? ...

SVN: Recurisvely add files?

I'm trying svn add *.py --force As the documentation suggests, but I know for a fact it's missing files nested in deeper folders. Why? Is there a standard way to do this with other unix commands too? */*.py will nab a few more files, but it's kind of a pain in the butt to do this for every possible depth. ...

iPhone Shell - is there any?

While working on iphone security architecture, i came to know that i can run applications from other applications in iphone. referring to the following url http://iphonedevelopertips.com/cocoa/launching-other-apps-within-an-iphone-application.html for example, i can put a link in a website with following hyperlink skype:// will res...

Why is the value of this string, in a bash script, being executing?

Hello Why is this script executing the string in the if statement: #!/bin/bash FILES="*" STRING='' for f in $FILES do if ["$STRING" = ""] then echo first STRING='hello' else STRING="$STRING hello" fi done echo $STRING when run it with sh script.sh outputs: first lesscd.sh: line 7: [hello: command not found le...

What is common between environments within a shell terminal session?

I have a custom shell script that runs each time a user logs in or identity is assumed, its been placed in /etc/profile.d and performs some basic env variable operations. Recently I added some code so that if screen is running it will reattach it without needing me to type anything. There are some problems however. If I log-in as root...

Printing Stdout In Command Line App Without Overwriting Pending User Input

In a basic Unix-shell app, how would you print to stdout without disturbing any pending user input. e.g. Below is a simple Python app that echos user input. A thread running in the background prints a counter every 1 second. import threading, time class MyThread( threading.Thread ): running = False def run(self): self....

How can I find out the original username a process was started with?

There is a perl script that needs to run as root but we must make sure the user who runs the script did not log-in originally as user 'foo' as it will be removed during the script. So how can I find out if the user, who might have su-ed several times since she logged in has not impersonated 'foo' at any time in that chain? I found an i...

Filtering Filenames with bash

I have a directory full of log files in the form ${name}.log.${year}{month}${day} such that they look like this: logs/ production.log.20100314 production.log.20100321 production.log.20100328 production.log.20100403 production.log.20100410 ... production.log.20100314 production.log.old I'd like to use a bash script ...

How to delete columns?

Hi all, I have generated the following text file below: fe120b99164f151b28bf86afa6389b22 -rw-r--r-- 1 joey joey 186 2010-03-14 19:26 Descript.txt 41705ea936cfc653f273b5454c1cdde6 -rw-r--r-- 1 joey joey 30 2010-03-14 20:29 listof.txt 0e25cca3222d32fff43563465af03340 -rw-r--r-- 1 joey joey 28 2010-03-14 23:35 sedexample.txt d41d8cd98f0...

Get seconds since epoch in any POSIX compliant shell

I'd like to know if there's a way to get the number of seconds since the UNIX epoch in any POSIX compliant shell, without resorting to non-POSIX languages like perl, or using non-POSIX extensions like GNU awk's strftime function. Here are some solutions I've already ruled out... date +%s // Doesn't work on Solaris I've seen some...

Insert copyright message into multiple files

How would you insert a copyright message at the very top of every file? ...

Simple file and folder view in C#

Hey there! I have seen an application recently what had two simple controls (a treeView and a detailed ListView) what were used for listing directories and files. I know how to do this, but it had another nice feature other than listing files: it loaded info from the system shell, like icons of folders, file specifications (file types m...

find prune not working

I am trying to find all ruby files in the project. However I want to ignore all the files residing under directory vendor. find . -name .vendor -prune -o -name '*.rb' -print Above command is not working. Anyone knows the fix? ...

Unix file naming convention for effective tab completion?

I feel like I often name files in such a way that my computer constantly beeps while I program because the tab completion is ambiguous. Before doing a lot of Unix programming, I tended to name related files with the same prefix to indicate their relation. Now I must re-think my approach to folder and file structures and names to program ...

Editing history in bash

In bash, when I go back in history, edit some command and run it, this edited command is appended to history and the original one is left intact. But every once in a while I somehow manage to affect the original command, i.e. my edit replaces the original command back in history. I can't put my finger on how this happens. Can someone exp...