unix

Make Arrow and delete keys work in Korn shell Command line

Hi all, I am new to unix and am using sun solaris (v10 i think) . I have my shell set as korn shell . i am wondering how to make the arrow keys and delete key work in the command line . I have done set -o emacs and the backspace works , but not the arrow keys and the delete keys . Also is it possible to set the up and down arrow key to...

linux: kill background task

How do I kill the last spawned background task in linux? Example: doSomething doAnotherThing doB & doC doD #kill doB ???? ...

Can one highlight tab characters in the terminal?

Using terminal sequences, I can colour text in a terminal emulator: $ echo -e '\e[37;41m--this is white on red--\e[0m' And this works. The following prints a red rectangle, i.e. space characters have a red background and an empty foreground: $ echo -e '\e[37;41m \e[0m ' But the following prints two red rectangles separated by ...

How to get the values of oracle database parameters from a unix development server?

How to get the fallowing details from the unix development server? The below parameter values should be provided in the .dbc file and it should be mapped to the ETL Server . dbms:<br> db_version:<br> db_home: <br> db_name: <br> db_nodes: <br> case: <br> generate_dml_with_nulls:<br> field_type_preference:<br> treat_blanks_as_null:<br> ...

trim junk characters from variable

I have a variable in my shell script that works as per my expectations. But when I use that variable as filename, I get ?? at the beginning of the string. How do I trim the junk characters? I use $(some command) to create this variable. ...

Compressing data before sending

I can copy the records from one server to another using the following command. mysqldump -hlocalhost -uroot -pPassWord db tbl_name | mysql -h100.100.100.100 -uroot -pPassword other_db tbl_name But is it possible to zip it up while sending the data? for e.g. mysqldump -hlocalhost -uroot -pPassWord db tbl_name | gzip ...

Getting $USER inside shell script when running with sudo ?

Hi, How do I get the correct $USER if I run a shell script with sudo ? I run them as postinstall scripts in a Mac install package, where they are being sudo-ed automatically, but I need to do stuff with the username. $HOME is correct, though. The inelegant method would be to extract the name from the home path, but I wonder if there ...

How to replace markup in html files stored on unix/solaris servers?

I'm looking for a way to grab a piece of markup that is in a 1000+ html files published on unix servers (running via apache) and replace the markup with either empty nodes or alternate html markup. ex: Find <div id="someComponent"> .....{a bunch of interior markup} .... </div> Replace with {empty} ex 2: Find </div></body> Replac...

Appropriate usage for JSON?

Great site! I have a question I haven't seen answered. I am very new to this, I didn't know what JSON was yesterday, so I apologize if this is a stupid question. A client has requested an JSON/XML type scheme to store data because they want a flat file to edit/update without having to deal with queries, and they want it flexible for fu...

What program/utility uses the special string "@(#)" in source code?

In comments in source code (especially older code), one may see in the header comments the filename, date and perhaps other info in this special format: /* @(#)fdlibm.h 1.5 95/01/18 */ (see also: http://www.google.com/codesearch?q=%22%40%28%23%29%22&amp;hl=en&amp;btnG=Search+Code ) This is quite similar (or perhaps related?) to the RC...

Named Pipes (FIFOs) on Unix with multiple readers

I have two programs, Writer and Reader. I have a FIFO from Writer to Reader so when I write something to stdin in Writer, it gets printed out to stdout from Reader. I tried doing this with TWO Readers open, and I got output to stdout from only one of the two Reader programs. Which Reader program Unix chooses to print stdout from seemed...

[APUE]Does parent and child share the same file offset after fork?

In APUE section 8.3 fork function, about file sharing between parent and child processes, It said: It is important that the parent and the child share the same file offset. And in section 8.9 Race Conditions, there is a example: both parent and child write to a file which is opened before invoking fork function. The program contains a...

Compare two java property files using shell script

How to compare two property files in two different folders using shell script input can be path of the two folders? There are multiple files in both folders and each files needs to be checked ...

Transfer file in blocks

In C (UNIX), how can I transfer and receive a file in multiple blocks using a socket? For example, if I had a file of 1234 bytes, and a block size of 500, I would transfer: 500 bytes, then 500 bytes, then 234 bytes I have attempted this using fseek, read, write, but I just cannot get the logic right. Even a good reference would b...

How to set environment variable for everyone under my linux system?

Can I have certain settings that are universal for all my users? ...

Converting .DLL to .SO

Hello, Can any one of you help me in converting an windows dll file in a .so file. ...

How can I edit/update hosts(etc/hosts) file using any programming language

Dynamically I want to edit/update hosts(etc/hosts) file to add domain. To edit hosts(etc/hosts) file require Admin privileged. Using Linux I can do this by this command sudo gedit /etc/hosts But I am trying to do this from using Programming Language. How can i do it? ...

I want to create this environment variable for everyone, but it does not load during startup? (linux)

I put this at the top, using "sudo vi /etc/profile": PYTHONPATH=/home/myuser:/home/myotheruser When I use putty and log in under my username, the python path does not work! I type "set", and it is there. But, importing things from that directory still does not work. When I manually do this, then it will work. EXPORT PYTHONPATH=/home...

Converting a unix time to a human readable format

I'm building my own unix time to human readable conversion, and I'm stuck. I can extract the year just fine, but the day is proving too tricky. /* Converts a 32-bit number of seconds after 01-01-1970 to a _SYSTEMTIME structure */ static _SYSTEMTIME Convert(unsigned long a_UnixTime) { newtime.wMilliseconds = 0; newtime.wYear = (un...

Is there a good way to detect a stale NFS mount

I have a procedure I want to initiate only if several tests complete successfully. One test I need is that all of my NFS mounts are alive and well. Can I do better than the brute force approach: mount | sed -n "s/^.* on \(.*\) type nfs .*$/\1/p" | while read mount_point ; do timeout 10 ls $mount_point >& /dev/null || echo "stale...