unix

HyperLink on the mail send from Unix

I am sending some text messages from the unix box to the normal internet mail id. I Wanted to add a hyper link in those mails, but link to a file on the system not to a URL. I'm doing it on local machine and i'm sending mail to my email-id. In that mail, I need a link to file which resides on my system itself. How I can do this? ...

How do I use python to hit this command and return the result?

$whois abc.com I want to use python to hit this command, and then give the result as a String of text. How can I do that? ...

How to run a tcsh shell command and selectively ignore the status?

I've got a tcsh shell script that I would like to stop with an error on nonzero status most of the time, but in some cases I want to ignore it. For example: #!/bin/tcsh -vxef cp file/that/might/not/exist . #Want to ignore this status cp file/that/might/not/exist . ; echo "this doesn't work" cp file/that/must/exist . #Want to stop if th...

How to determine what user and group a Python script is running as?

I have a CGI script that is getting an "IOError: [Errno 13] Permission denied" error in the stack trace in the web server's error log. As part of debugging this problem, I'd like to add a little bit of code to the script to print the user and (especially) group that the script is running as, into the error log (presumably STDERR). I kn...

image magick ,text arc

system(' convert -size 320x100 xc:lightblue -font Courier -pointsize 72 \ -fill navy -annotate +25+65 \'Ernakulam1\' \ -virtual-pixel transparent -distort arc 120 \ -bordercolor lightblue font_arcnew.jpg'); This coe is not working Example arc the text mainly this code is not working -virtual-pixel tran...

Parse string with bash and extract number

Hello I've got supervisor's status output, looking like this. frontend RUNNING pid 16652, uptime 2:11:17 nginx RUNNING pid 16651, uptime 2:11:17 redis RUNNING pid 16607, uptime 2:11:32 I need to extract nginx's PID. I've done it via grep -P comman...

transferring binary files between systems

Hi guys I'm trying to transfer my files between 2 UNIX clusters, the data is pure numeric (vectors of double) in binary form. Unfortunately one of the systems is IBM ppc997 and the other is AMD Opteron, It seems the format of binary numbers in these systems are different. I have tried 3 ways till now: 1- Changed my files to ASCII for...

how to include input files while running a program on unix

When running my program (unix) I want to include two input files. How is this done? ...

Don't display ^M characters with emacs

Hi Guys, I am wondering if there is a way to have to temporaly not displaying the ^M characters in a file. I don't want to remove them I just want to not displaying them. Cheers, ...

SSH copying folders

I have a folder on my server that I'd like to copy to another directory. However, after I copy it and navigate to the new folder, some of the directories are RED and I can't navigate into them. I think this has something to do with them creating links instead of actually copying the folders. cp -a site2.com/httpdocs site1.com/httpdocs ...

Resources for learning C, Unix, Linux and embedded systems

Hi, I want to learn C , UNIX and LINUX, and more about embedded systems. Very much interested in them. Are there any online courses or websites which can guide me. And please suggest books to read in learning them. Thanks for your time. Ya please lets your answers and comments come in , they are invaluable to me..!! ...

Regarding grep in solaris

I want grep for a particular work in multiple files. Multiple files are stored in variable testing. TESTING=$(ls -tr *.txt) echo $TESTING test.txt ab.txt bc.txt grep "word" "$TESTING" grep: can't open test.txt ab.txt bc.txt Giving me an error. Is there any other way to do it other than for loop ...

BASH Script to Check if a number is Armstrong or Not

Hi, I was writing a script to check if a number is Armstrong or not. This is my Code echo "Enter Number" read num sum=0 item=$num while [ $item -ne 0 ] do rem='expr $item % 10' cube='expr $rem \* $rem \* $rem' sum='expr $sum + $cube' item='expr $item / 10' done if [ $sum -eq $num ] then echo "$num is an Amstrong Number" else echo "$num ...

Simple Bash Programming.

I am a newbie to BASH so please dont mind my stupid questions because I am not able to get any good sources to learn that. I want to create a script to display filename and its size. This is what the code is like filename=$1 if [ -f $filename ]; then filesize=`du -b $1` echo "The name of file is $1" echo "Its size is $files...

Bash Script using Grep to search for a pattern in a file

I am writing a bash script to search for a pattern in a file using GREP. I am clueless for why it isnt working. This is the program echo "Enter file name..."; read fname; echo "Enter the search pattern"; read pattern if [ -f $fname ]; then result=`grep -i '$pattern' $fname` echo $result; fi Or is there different approach to do...

static library creation

in general we use ar rcs command to create a static library on unix. what does the flag 's' mean over here man page says Do not generate an archive symbol table. This can speed up building a large library in several steps. The resulting archive can not be used with the linker. In order to build a symbol table, yo...

Bash: Is it ok to use same input file as output of a piped command?

Consider something like: cat file | command > file Is this good practice? Could this overwrite the input file as the same time as we are reading it, or is it always read first in memory then piped to second command? Obviously I can use temp files as intermediary step, but I'm just wondering.. t=$(mktemp) cat file | command > ${t} &&...

obtaing File Format in java/ DOS-UNIX

Is there an easy way to see whether particular file has DOS/MAC/UNIX line endings? Currently i read the file byte by byte and stop if i see Windows carriage return for (byte thisByte : bytes) { if ((!isDos) && (thisByte == 13)) { isDos = true; } ... Is there a way to get same information without reading file byte by byte? ...

Curving text using image magick

system(' convert -size 320x100 xc:lightblue -font Candice -pointsize 72 \ -fill navy -annotate +25+65 \'Anthony\' \ -distort Arc 120 -trim +repage \ -bordercolor lightblue -border 10 font_arc.jpg '); curving text like arc This code is not working please help me ...

undo continually vi

Hi, I am using vi(not Vim) and I would like to continually undo the changes made. u works for a single command undo and Ufor a single line undo. But Is there a way to undo continuously like vim(I recall a command in vim can even undo changes by time!) in vi? Thanks in Advance. Edit: I am using vi version 3.10 ...