unix

Unix script to find all folders in the directory

Basically I need to run a Unix script to find all folders in the directory /fss/fin, if it exists; then I have tar it and move to another directory /fs/fi. This is my command so far: find /fss/fin -type d -name "essbase" -print Here I have mentioned folder name essbase instead of that I have to find all the folder in the /fss/fin. ...

Case sensitivity in shell script.

How to overcome the case sensitivity while accessing a file in unix using shell script.? I have a file namely file.txt in the designation path and in script while accessing the same file with the name FILE.txt it throws the error as Cannot open File. Please guide me how to access the file with case change in unix scripting. How to tur...

What does process exit status 3 mean?

I've seen the usage of exit status 3 in several python scripts that restart processes. As far as I know the convention is only about 0 and "not 0" on Unix/Linux. Is there a convention defining other values like 3. ...

Is it possible to generate a public key from private key?

If yes then they are really not a pair. I was trying to figure out how ssh [email protected] resolves my name using my private key. SSH debug suggests public key is passed to server. ...

Unix sort is not consistent!

Hi i'm running the commands zcat [File] | sed "1d" | sort -t $'\xE7' -k [field to be sorted] > [file].sorted When i run this on File A sorting on field 1 i get 11622400 , abe, def 11622401 , abe, def 11622402 , bbabe, def 11622403 , ddabe, def 11622404 , acdc, dere 11622405 , ddabe, bere 11622406 , abe, fgh 11622407 , adbed, ddee 11...

Reading from pipe using poll

Hi im trying to read data from pipe using poll, here is code: #include <stdio.h> #include <fcntl.h> #include <poll.h> #define MAX_BUFF_SIZE 128 int main(void){ char buff[MAX_BUFF_SIZE]; char *buf; int fd,ret,len; struct pollfd fdinfo[1]; if((fd = open("/home/s/pipe", O_RDONLY)) == NULL) { printf("Error Ope...

Package command line tool with Cocoa app?

Disclaimer: Cocoa newbie here. I wrote an app with a Cocoa GUI that acts as a wrapper for a command line tool. The problem is the tool does not come standard with OS X. Thus, you have to install the command line tool first before using the Cocoa app, or else the app won't function. Can anyone point me to some documentation (hopefu...

How do I fix unix so that I can use the cursor on the shell?

I was able to use the up/dow arrow to cycle through previous commands, now when I press a directional key it outputs "^[[A". I'm running on a bash shell. How do I fix this? Thanks ...

Can I make an alias with a parameter?

So i want to run a script that requires me to input the name of a file. For example: /userthatisnotme/bin/move filename So I want to make it easier for me to remember, so I can just type move filename instead of that whole path. How can I do this? ...

Crazy idea: Identify if system is idle when it's a black box

I need to be able to tell if a series of servers have anyone active on them, and if not then to automatically shut them down (turn off the VM). It's not a trivial task, because I have 1000+ server instances that include an assortment of OSes (Win, Unix, Linux) and many different type of configurations. This makes installing an uptime age...

What is a unix command that will always return nothing no matter what parameters are given to it?

I want to put it at the top of a unix executable. right after the #! I know it seems silly, but I would like suggestions. ...

UTF-8 encoding problem in unix machine

Im exporting a set of data to excel in java, the data has certain non ascii characters, while exporting in Windows machine the data are coming correctly in UTF-8 encoded format.But when i deploy my code in Unix machine it is not working properly.UTF-8 encoding is not working properly. Im using Tomcat 5.5 server.I have also included URIen...

Possible to authenticate facebook from unix console?

I'm playing around with an embedded device, running a linux kernel. It has web access via a proxy. My question is, is it possible to login via the unix console? I can retrieve the login page using wget http://m.facebook.com, but I'm not sure where to go from there. Thanks in advance. ...

PrintUnixDialog and mono

Hi, I'm new to Mono and I do not understand how this dialog and the PageSetupUnixDialog work I have searched it on google for hours but i havn't found anything So if you know a good tutorial please post the link, or if you hava a sample I hope my english is not too bad, so Thanks in advance ...

Replacing string in textfile with quotes and doublequotes with sed

Hello, Lets say I want to replace the following string within a textfile: document.write(unescape("%3Cscript src='" + \ + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E")); I came up with this sed command, but surprisingly nothing happens at all. sed -i "s/document.write(unescape(\"%3Cscript src=\"\' + \\ + \"go...

Puzzling output of the time command

I am trying to benchmark the run time of one of my scripts. I get following output #time ./foo.py real 0m37.883s user 1m0.648s sys 0m4.680s # Internally, foo spawns multiple other processes and waits till all of them die. From this thread and my earlier understanding of real, user and sys times, I had thought that real time ...

How to interleave the lines of two text files in Linux?

What's the easiest/quickest way to interleave the lines of two (or more) text files? Example: File 1: line1.1 line1.2 line1.3 File 2: line2.1 line2.2 line2.3 Interleaved: line1.1 line2.1 line1.2 line2.2 line1.3 line2.3 Sure it's easy to write a little Perl script that opens them both and does the task. But I was wondering if it...

Simulating a directory tree platform-independently

I am using Qt and Ruby in an application where I have to manipulate some directories and rename/move files. However, prior to the actual manipulation I need to show a "preview", ie, simulation of the changes. What I've done on OS X and Linux is a collection of mkdir and touch commands, in a writable tmp space, to build my said "directory...

unix shell code portable to run on all shells

H all, Hope all is well, Can any one please let me know the coding guidelines along with code samples of unix shell scripting by using which the code can run on most of the current shells like ksh, bash, csh etc. Most of the times some of my code written for ksh would not work on normal sh. I want to make my code maximum portable. Most...

How can I read one line at a time with C shell in unix

I try to make a small script, using c shell, that will take a file made of several lines, each containing a name and a number and sum all numbers that a have certain name. How can I put into a variable the next line each time? the summig part I do by: (after I'll be able to get a full line to $line) set line =($line) @ sum = $sum + $li...