shell

Display function definition in interactive shell

I am working in the Python Interactive Shell (ActiveState ActivePython 2.6.4 under Windows XP). I created a function that does what I want. However, I've cleared the screen so I can't go back and look at the function definition. It is also a multiline function so the up arrow to redisplay lines is of minimal value. Is there anyway to ret...

Copy folder recursively, excluding some folders

I am trying to write a simple bash script that will copy the entire contents of a folder including hidden files and folders into another folder, but I want to exclude certain specific folders. How could I achieve this? ...

Why does this if statement fail in bourne shell?

I'm learning shell scripting but I can't work out this error, any help much appreciated. #!/bin/sh LOCATION=/tmp/loc PROXY=http://wwwproxy.unimelb.edu.au:8000 http_proxy=$PROXY; export http_proxy echo "Installing into" $LOCATION if [ ! -d $LOCATION ]; then mkdir $LOCATION; fi if [ ! -d $LOCATION/packages ]; then mkdir $LOCATION/packag...

Passing Bourne Shell var into cut command

I am trying to do the following. foo="foo:foo1" cc= `$foo | cut -f2 -d:` I understand why this would not work but I am at a loss as to do this. Thanks in advance. ...

How to clear shell buffer in Terminal in Mac OS X?

I know 'clear' command clears current screen, but the cleared contents just scrolled up. Is there a way to clear all cleared buffer contents? I'm figuring this to prevent scrolling up on Terminal. ---(edit)--- I'm finding a way which can be used in shell script. Or program. ...

Bash - How to call a function declared in a parent shell?

I am writing a bash script that calls functions declared in the parent shell, but it doesn't work. For example: $ function myfunc() { echo "Here in myfunc" ; } $ myfunc Here in myfunc $ cat test.sh #! /bin/bash echo "Here in the script" myfunc $ ./test.sh Here in the script ./test.sh: line 4: myfunc: command not found $ myfunc Here ...

Bourne Shell Left Right Justify

I am trying to do some formatting on output data in a script and not positive how to do Left Right justify as well as width. Can anyone point me in the right direction? ...

Is it possible to get the transfer time in milliseconds using wget?

Generally, wget shows transfer time in seconds... Is there a way I can get it to show the time in milliseconds? ...

Replacing all GUIDs in a file with new GUIDs from the command line

I have a file containing a large number of occurrences of the string Guid="GUID HERE" (where GUID HERE is a unique GUID at each occurrence) and I want to replace every existing GUID with a new unique GUID. This is on a Windows development machine, so I can generate unique GUIDs with uuidgen.exe (which produces a GUID on stdout every tim...

Korn Shell SegFault

I have found the following script causes a segmentation fault and core in kshell on AIX. Can anyone explain why I get the following results? Seg Fault doOutput(){ Echo "Something" } doOutput() >&1 OR doOutput(){ Echo "Something" } echo `doOutput()` No Output doOutput(){ Echo "Something" } doOutput() Correct doOutp...

Using awk (or sed) to remove newlines based on first character of next line

Hello everyone, here's my situation: I had a big text file that I wanted to pull certain information from. I used sed to pull all the relevant information based on regexp's, but each "piece" of information I pulled is on a separate line, I'd like for each "record" to be on its own line so it can be easily imported into a DB. Here's a sam...

Showing a Windows context menu for multiple items

I have an application that lists files, and I allow the user to right-click on a file and my application shows the Windows context menu for the selected file. I use SHParseDisplayName to get a pidl for a filename. Then I bind to the parent object: IntPtr pidlLast = IntPtr.Zero; SHBindToParent(pidl, typeof(IShellFolder).GUID, out oShell...

start without inheritance of parents file descriptors

Hi I need to start some process on winXP with "start" command. Sounds simple. But is there a way that the started process would not inherit any ports from parent? I start children in my program using: system "start x -params" Now when parent is being killed, I can't start it again because I'm learned by errors that some process is a...

Bourne Shell exit will not work

Hi, I have the following script cat $1 | while read line do line=`echo $line | tr "[:lower:]" "[:upper:]"` if [ "`echo $line | cut -f1 -d:`" = "foo" ] && \ [ "`echo $line | cut -f2 -d:`" = "bar" ]; then echo 'exsist' exit 1; fi done everything works up to echo and then when the script hits exit it ...

"cvs copy" a file to create a new file

hi, I have a file dir1/foo1 in CVS. I want to create a "cvs copy" of this file in CVS to dir1/foo2 I want to do this so as to retain the cvs history . (foo2 will only have a function defined in foo1) can anyone please help with the command line syntax? ...

file manipulation : shell script find and increment

#something here port 4444 #something here port 4444 So I have file like above , I would to find the line with word "port" and increment the number(the number can be any number - not necessary it's fixed at 4444) next to it by 1. For example,result file should be of the form #something here port 4444 #something here port 4...

How to transform multiple line into one line in bash stdout ?

Hello, I sometimes do this in my shell : sam@sam-laptop:~/shell$ ps aux | grep firefox | awk '{print $2}' 2681 2685 2689 4645 $ kill -9 2681 2685 2689 4645 Is there a way I can transform the multiple lines containing the PIDs into one line separated by spaces ? (It's a little bit annoying to type the PIDs every time and I really wou...

basics of using cut awk grep and sed...

Hello there, I'm trying to extract the year from this output : sam@sam-laptop:~/shell$ date Mon Feb 8 21:57:00 CET 2010 sam@sam-laptop:~/shell$ date | cut -d' ' -f7 2010 sam@sam-laptop:~/shell$ date | awk '{print $6}' 2010 Are there any other ways to get the same result ? using maybe grep, sed etc ? Merci ! ...

shell script not running via crontab, runs fine manually

Hey guys, Before you guys jump on me for asking this question which is asked a million times over and over. Yes I have tried exporting my paths and variables and crontab still will not run my script. I'm sure I am doing something wrong. I have a shell script which runs a jar file. This is not working correctly. After reading around ...

shell script to get the file name from a text

I need to get the name of the file (esrt-deghasdf-keystore) before .jks.I want to do it using shellscript.Is it possible? abcdefgh 7369 4825 0 00:12:26 pts/10 0:37 java -Djavax.net.ssl.keyStore=/abc3/esrt/der/fer-def2/esrt-deghasdf-keystore.jks ...