shell

Portable way to achieve ls' -v flag (i.e. sort by version)?

I'm working on a some build scripts that I'd like to depend on only standardized features. I need to sort some files by version. Say the files are bar-1.{0,2,3} bar-11.{0,2,3}. By default, ls gives me: bar-1_0 bar-11_0 bar-11_2 bar-11_3 bar-1_2 bar-1_3 Getting what I want is easy using 'ls -v': bar-1_0 bar-1_2 bar-1_3 bar-11_0 bar-...

Enable zsh using 8th bit as Meta without warning

In my quest to configure my shell to work exactly how I want it with respect to the alt/meta key I am having some trouble. Recently I added "bindkey -m" to my .zshrc and now whenever I start a zsh shell (ie open a terminal window) I get this error "warning: `bindkey -m' disables multibyte support". Now since I don't care much about mult...

Used MacPorts to install WordPress. Where is it now?

Hi, I used MacPorts shell to download and install WordPress: port install wordpress It went just fine: ---> Computing dependencies for libxml2 ---> Fetching libxml2 ---> Attempting to fetch libxml2-2.7.5.tar.gz from http://arn.se.distfiles.macports.org/libxml2 ---> Verifying checksum(s) for libxml2 ---> Extracting libxml2 --->...

How to store output from command to a path?

I am currently running a command and it is producing the compressed file. I need to store that zip file into c:\windows\abc.zip. Does anyone know how to do that? MY current command is something like this: cd %path% cdx.exe I have tried specifying the path after cdx.exe but it doesn't store in that path. It is running the exe but stori...

How to use '-prune' option of 'find' in sh?

I don't quite understand the example given from the 'man find', can anyone give me some examples and explanations? Can I combine regular expression in it? the more detailed question is like this: write a shell script, changeall, which has an interface like "changeall [-r|-R] "string1" "string2". It will find all files with an suffix ...

Replacing the explorer pane in windows?

When a user puts in a CD and autoruns, I want to "browse" the CD but I want to do some extra processing of the disk contents. If I wanted to replace the ListView in windows explorer with one of my own, how would I start? What terms should I search for to find out how to do this. I want to get the treeview part that explorer provides, ...

Browsing WPD's content through Windows Explorer

I noticed that when I plug in my Nokia phone, an icon will appear in My Computer in windows explorer and I can browse the content of my phone through windows explorer. Is this concept similar to developing Shell Namespace Extension for virtual folder? I notice that Shell Namespace Extension is categorised as System Folder while my phone...

Grep ignore multiple lines

Is there a way with Grep to use the -v switch to ignore a line and the next number of lines after it. Its basically to filter exceptions from a log file i.e. Valid log entry 1 Exception exceptionname at a.b.c at d.e.f ... Valid log entry 2 grep it to produce : Valid log entry 1 Valid log entry 2 I have tried grep -v Ex...

Python: can you tell the name of the calling shell?

I have a python script that is always called from a shell, which can be either zsh or bash. How can I tell which one called the script? ...

How do you manage/store/arrange your alias in *nix?

I have a million of alias stored in my .cshrs file. I wonder if it is preferred way or people use other files to do it and then loaded into the environment. How do you do it? ...

Taking up/down arrow as input to a program in Unix

I am implementing my own shell. But to supprt for command history, I need to use monitor up/down arrow key as in standard shells. Please tell me how to handle arrow keys as input or does these keys generate signals? Please elaborate. ...

How can I implement my own basic unix shell in C?

My Shell should understand PATH environment variable. It can be set and modified. It runs in two ways -interactive & batch mode. Shell is capable of taking more than one job like ls;ps;wc file;cal. I know I will have to use execs, forks and pipes but just cant get started. Thank you in advance. Edited: PS:Not a homework question. Newb...

How to make a cronjobbable script to clock uploads?

I asked a similar question over here:(http://stackoverflow.com/questions/1495604/upload-clocking-script), but then changed it and realized it's a different question now. I want to make a script called uploadtimer.sh which uploads files to various hosts and then notes the time the upload takes in a log file. Thanks to those who have hel...

Capturing keycodes in shell?

I am writing my own shell and need to implement a history feature where up and down arrow keys show history of commands executed. I need to find out when up and down keys are pressed. How do i do this? ...

file empties itself

hello i have a shell script that sends out email. here is how it works: it reads the html from an url and put it in a file loop through all the emails and in the loop it reads from that html file the problem is: the html file becomes empty after a few hundred email for no apparent reason. (i put du /thehtml.html in the email log.)...

How to add timestamp to STDERR redirection

In bash/ksh can we add timestamp to STDERR redirection? E.g. myscript.sh 2> error.log I want to get a timestamp written on the log too. ...

wget - http://: Invalid host name.

I'm using wget to automatically download the ShellEd extension for Eclipse, but am receiving an error: http://: Invalid host name. I have used it successfully several times before, so I think it's because SourceForge uses a mirror. I've looked at the man page for wget, focusing on referer and http_proxy, but am still unsuccessful. H...

How can we find out the job ID of a process in C ?

Does the shell allocates a job ID to all processes(foreground and background)? jobs command shows the existing background jobs. How do we see job ID of foreground process? I want to use a function in C (like getpid()) to get the job ID and status of a given process given the pid of the process. What is the maximum value of a job ID? ...

Exit a Screen after a script is finished.

When a script that I started in a screen is finished can I tell it to close the current Screen it's in? If so how? I know I can do "ctrl + a" then k, then y. To kill it but Im not there to issue those buttons. And I tried adding "exit" to the end of the script which doesn't seem to close it ether. I also have a script that will auto sta...

What's the cgi-bin equivalent of getRequestDispatcher("/myURL").forward(request, response)?

I'm using #!/bin/sh as my language. ...