Hi!
I'm planning to package OpenTibia Server for Debian. One of the things I want to do is add startup via /etc/init.d and daemonization of the otserv process.
Thing is, we should probably redirect output to syslog. This is usually done via the syslog() function. Currently, the code is swarmed with:
std::cout << "Stuff to printout" <<...
I have processes that I background with screen. I'm trying to write a script that attaches to a terminal, executes a couple commands, then detaches. The problem is that when I attach to a terminal, screen directs control to the user. How do I work around this?
...
Hi,
On unix, we can specify the ftp username/password in ~/.netrc file and next time onwards,there is no need to specify username/password while ftping to any machine provided the credentials for that machine exists in ~/.netrc file.
Its very helpful especially if you need to login to multiple machines may times lets say for monitoring...
This should be simple for those of you who have some programming knowledge... Unfortunately I don't.
I'm trying to iterate through a text file of image captions and add them as title tags to an html file. The image captions file has 105 captions (each is separated by a carriage return) and the gallery file has blank alt tags on each a t...
How can I set variables that work everywhere? My .bashrc has:
Questions='/Users/User/Stackoverflow/Questions'
Address='My address'
My file has:
$Questions
$Addres
The command "$ cat my_file" in Shell prints "$Questions" and "$Address", instead of "/Users/User/Stackoverflow/Questions" and "My address". Other places where I would li...
I would like to compare all GNU Unix manuals and and Mac's Unix manuals by sdiff.
I do not know how you go through, for instance, all Mac's Unix manuals and then save them to a file.
The comparison can be done by the following code when the manuals are in two files
sdiff <(file1) <(file2)
Perhaps, there is some index of Unix command...
I have a data that looks like this:
-1033
-
222
100
-30
-
10
What I want to do is to capture all the numbers excluding "dash only" entry.
Why my awk below failed?
awk '$4 != "-" {print $4}'
...
I am working on a Unix system. I have a directory of files called MailHistory. Each file in the directory contains all of the emails for the previous day.
The files are created at midnight and named with the timedatestamp. So, a typical filename is 20090323000100.
I have a file that has a list of names. Using this file as input, I...
We have several UNIX machines you can wind up with when you telnet to a certain box. The passwd files are not on a shared mount (I am not sure how safe it is to mount them anyway). The end result is that if you change your password on one box that when you login to the second box it will tell you that your password is invalid. This ma...
Hi, i have problem with substitution. I have a file with 1 line of random characters with brackets "{}" around 1 character. I want to move with these brackets on the previous character or on the next one. (I know how to do it if the line of character is still, non-changing.) But I wonder how to do it when I don't know these chars and I d...
Can someone please give me an example of using xargs on the below operation?
tar c $dir/temp/*.parse\
| lzma -9 > $dir/backup/$(date '+%Y-%m-%d')-archive.tar.lzma
I get the error from bash "/bin/tar: Argument list too long"
Particularily I am trying to do LZMA compression on about 4,500 files; so this isn't surprising. I just do...
I know there is not a direct way to take a screen shot of a web page with PHP. What would be the most straightforward way to accomplish this? Are there any command line tools that could do this that I might be able to execute from a PHP script (I'm thinking something that would run in a 'NIX OS (OS X and/or Linux in particular)?
Edit: ...
How would you assess a Unix sys-admin.
What programming competences should a Unix admin have?
...
Is there a convention for documenting shell scripts' parameters?
For example:
#!/usr/bin/env bash
# <description>
#
# Usage:
# $ ./myScript param1 [param2]
# * param1: <description>
# * param2: <description>
A few things I don't like about this particular template:
the script's file name (myScript) appears within the file itself
...
I write shell scripts to do various things in OSX and Linux, but I always have the same problem. The script runs but any changes it makes to the environment (except the disks, of course) do not "stick." When the script terminates the changes revert.
How can I make my changes stick?
Edit: A lot of the answers have been great, but they h...
As someone who did a lot of sh scripting twenty years ago, and now coming back to it again, I find I'm using techniques that are considered obsolete. I should take the time to read the "What's new", but I don't. and it's not terribly efficient. Examples:
Instead of use
tmpfile=/tmp/me$$ tmpfile=`mktemp`
[ ] ...
I have a program running as root on Linux, talking to a tty (actually an LCD implemented as a tty). The device for what it's worth is /dev/ttyUSB0. I'd like to have my program that writes to this device be able to have exclusive access to the device, so as to not have any interference from other instances of the program running at the sa...
Hi, I have the below command line argument which will print the output of aaa.sh to the screen while also writing stdout to bbb.out; however I would also like to write stderr to a file ccc.out. Any suggestions on how to modify the below piece? Thanks!
./aaa.sh | tee ./bbb.out
Update: stdout and stderr should still both be printed to ...
Hi all,
I have a 10^7 lines file, in which I want to choose 1/100 of lines randomly
from the file. This is the AWK code I have, but it slurps all the file content
before hand. My PC memory cannot handle such slurps. Is there other approach to do it?
awk 'BEGIN{srand()}
!/^$/{ a[c++]=$0}
END {
for ( i=1;i<=c ;i++ ) {
num=int(r...
hey,
I connect to a solaris (10) server through SSH from my linux machine.
However, when I attempt to open another terminal using " xterm" , then it does not work.
I set the DISPLAY env variable to 127.0.0.1:0.0, but it gives the following error:xterm Xt
error: Can't open display: 127.0.0.1:0.0
Please suggest a solution to rect...