Hi,
I am wondering whether python's shutil.move is atomic on linux ? Is the behavior different if the source and destination files are on two different partitions or is it same as when they are present on the same partition ?
I am more concerned to know whether the shutil.move is atomic if the source and destination files are on the sa...
Hi!
I am trying to use the simple fuinction below. But i get error sayin unary oprator expected and the output is always one. Can any1 help me correct it.
#!/bin/bash
checkit ()
{
if [ $1 = "none" ]
then
echo "none"
else
echo "one"
fi
}
checkit
...
Hi, I am new to UNIX and when I was reading a book about UNIX, I came across following two problems that I didn't understand. I would really appreciate your help.
1) Look up the man page for the file command, and then use it on all files in the /dev directory. Can you group these files into two categories?
2) Run the tty command, and ...
Here's what I'm trying to achieve.
I have a directory with over 4200 sub-files/sub-directories, all of which need to be set to a certain timestamp.
This is a problem because many of them have whitespaces and other weird characters.
First thing I tried:
touch $(find .)
Won't work because of the spaces. It will update the timestamps o...
hi all,
i am new in unix. i have to write a shell script which read a file line by line and store it in a separate variable. my text file contents multiple source path and one destination path.
something like this::
source_path=abc/xyz
source_path=pqr/abc
desination_path=abcd/mlk
number of source path can vary.
I dont have much hands ...
There are a lot of example implementations of daemons on the net. Most that I saw do not use the daemon(3) function to run the program in the background. Is that just a matter of taste, ignorance, or is there a good reason to write my own daemonize function? Is there a specific disadvantage in using daemon(3)? Is it insecure?
...
I have two lists of files which I want to diff.
The second list has more files in it, and because they are all in alphabetical order when I diff these two lists I get files (lines) that exists in both lists, but in a different place.
I want to diff these two lists, ignoring line place in the list.
This way I would get only the new or mi...
#include <iostream>
using namespace std;
int main()
{
char buffer[8];
int field=534;
memcpy(buffer,&field,sizeof(field));
cout<<buffer<<endl;
return 0;
}
This returns an empty buffer. Why?
Basically looking for an alternative to sprintf to convert int to char buffer.
Itoa is not available.
Thoughts? Bet...
I've learned that you should usually stick with either forking or threading to avoid running into very strange and extremely hard-to-debug problems, so until now I always did exactly that. My problem with the matter is that when I stick with only forking, creating many short-lived processes to distribute chunks of work to gets the more e...
How to add daemon stop, start and report function to this daemon code?
#include <sys/types.h>
#include <sys/stat.h>
#include <stdio.h>
#include <stdlib.h>
#include <fcntl.h>
#include <errno.h>
#include <unistd.h>
#include <syslog.h>
#include <string.h>
int main(void) {
/* Our process ID and Session ID */
pid_t pid, sid...
If you call the top command, you get all the running processes. But how can I limit the output only to a certain process name like "java"?
I've tried this
top -l 2 | grep java
but in this way you get only snapshots and not a continuously updated list. And top -l 0 | grep java is not really clear.
...
Currently I have a UNIX executable that I am compiling from xcode. It runs in terminal. (osx) I'm wondering if there is a way to call functions / interact with a flash or flex project. I found some information about a flex c++ bridge, but apparently it is only for windows. Can this be done with air? Any suggestion?
...
Hi,
I want to execute following command in shell script
cp /somedire/*.(txt|xml|xsd) /destination/dir/
But this does not run inside shell script. Any quick help?
createjob.sh: line 11: syntax error near unexpected token `('
My shell is zsh.
Thanks
Nayn
...
Hi I'm trying to compile about 30 C sources written in 1997.
Based on required header files such as XmAll.h and Xlib.h and the use of "Widget" syntax, I found that these sources depend on the Motif programming tool kits, so it seems they should be compiled in Linux or Unix system.
I have no any experience with X Windows Programming and ...
In the 2nd edition of "The C Programming Language" by Kernighan and Ritchie they implement a simplified version of the UNIX command ls (section 8.6 "Example - Listing Directories", p. 179). For this purpose they create the following interface which provides a system-independent access to the name and inode number of the files stored in a...
I have a shell script that starts an ssh session to a remote host and pipes the output to another, local script, like so:
#!/bin/sh
ssh user@host 'while true ; do get-info ; sleep 1 ; done' | awk -f parse-info.awk
It works fine. I run it under the 'supervise' program from djb's daemontools. The only problem is shutting down the daemon...
Basically I want to do a program almost like a keylogger. The thing is that I as network admin sometimes I don't remember what I did to a machine on certain case, or same times I make howto's and tutorials for linux. I want to record what have i done.
So basically the idea of this program is:
you type the name of the program, (I call it...
my parent process is unable to catch the SIGCHLD even though its on waitpid(SIGCHLD... for it.
Tried giving an explicit kill(SIGCHLD..) to the parent from the child to test the parent is not receiving the signal .also the flavor is AIX...do we need to compile it with some flags or some env setup ?
...
I want to change the read only attribute from a file when I save it with :w! in vim. How do I do it? (I don't mind if I have to call an external script).
I'm using Linux.
I know I can use an external script using this command: autocmd BufWrite /tmp/* !sh /tmp/script.sh. So, I would like to call a chmod command when :w! is invoked: the ...
I ssh into a remote linux sever from my Mac, and run gdbtui to debug a program. The source code displays, but the cursor line in the source code window frequently is not highlighted. I can enter commands such as 'next' and 'list' in the command line window, but the source code window doesn't redraw correctly. It sometimes shows lines in ...