unix

How to use C++ Boost library with pkg-config?

I successfully compiled and installed the latest version of the Boost library onto my linux machine. Now, I would like to be able to use pkg-config to ease the process of providing linking paremeters with GCC. Since I am too lazy for hand-coding my own .pc file, is there a script/tool which would automatically generate the needed .pc fi...

wrong home folder in programs

Hello, I originally installed ubuntu but switched to using kde. Now every gnome programs (e.g. gnome-terminal or gedit) start with ~/Downloads as standard folder. gedit always wants to save in ~/Downloads and gnome-terminal puts me in ~/Downloads. Konsole doesn't. What do I have to change to set this right? ...

how to pass file as an argument to the script file

Hi Everyone, I have a shell script written in bash and this script should take file as an argument,can any one tell me how to write script for this any ideas on this are apprecited Thanks, ...

Ubuntu server: manually changed /etc/passwd shell for my user, now can't login

I attempted to change shell from bash to tcsh via editing /etc/passwd file directly. Yeah, dumb move. I guess I've learned my lesson. Now I can't SSH into the remote server. Any way to fix this? PS. I can still connect to MySQL server via SSH tunnel. Any way to use this? ...

How to make a multi-character parameter in UNIX using getopt?

I'm trying to make a getopt command such that when I pass the "-ab" parameter to a script, that script will treat -ab as a single parameter. #!/bin/sh args=`getopt "ab":fc:d $*` set -- $args for i in $args do case "$i" in -ab) shift;echo "You typed ab $1.";shift;; -c) shift;echo "You typed a c $1";shift;; esac done How...

Regarding grep command

I have two queries I do a grep and get the line number of the input file. i want to retrieve a set of lines before and after the line number from the inputfile and redirect to a /tmp/testout file. how can i do it. I have a line numbers 10000,20000. I want to retrieve the lines between 10000 and 20000 of the input file and redirect ...

Turn off colors in Netware console?

I'm looking for a method of changing colors in default Novell Netware (OES) console ...

for loop with bash from variable

Lets say I have a variable which has values : #!/bin/sh MYVARIABLE="first,second,third" for vars in MYVARIABLE do echo $vars done this above doesn't work what I want but it looks fine, this should print first second third without , I wan't it to be printed without , any sugestions? ...

In-place processing with grep

I've got a script that calls grep to process a text file. Currently I am doing something like this. $ grep 'SomeRegEx' myfile.txt > myfile.txt.temp $ mv myfile.txt.temp myfile.txt I'm wondering if there is any way to do in-place processing, as in store the results to the same original file without having to create a temporary file and...

sqlite journal file location

Curently sqlite is writing journal file in the same directory where is placed database file. It makes a problem with the directory permission (it has to be writable). Is there any method to force sqlite to write journal files in other directory? ...

How does cron internally schedule jobs?

How do "modern" cron daemons internally schedule their jobs? Some cronds used to schedule a run every so often via at. So after a crontab is written out, does crond: Parse the crontab for all future events and the sleep for the intervals? Poll an aggregated crontab database every minute to determine if the current time matches the sc...

Delete newline in Vim

Is there a way to delete the newline at the end of a line in Vim, so that the next line is appended to the current line? For example: Evaluator<T>(): _bestPos(){ } I'd like to put this all on one line without copying lines and pasting them into the previous one. It seems like I should be able to put my cursor to the end of each ...

Practice Unix on Windows Machine

Hi Folks, I want to practice Unix (mostly Korn Shell Scription and VI Editor) on a windows Vista machine. Whats the best solution for this? I dont like Cygwin.. so anything other than Cygwin which gives the closest feel of Unix Environment without re-installing the OS. Thanks. ...

Multi threaded client server

Hi I am working on an assignment writing multi threaded client server. So far I have done is open a socket in a port and forked two thread for listening and writing to client. But I need to connect two type of clients to the server and service them differently. My question is what would be my best approach? I am handling connection in a...

Shell script to find time zone offset from UTC

Is there a reliable way to find the UTC-offset of a given time zone in the shell? On my linux box, I can use TZ=[TIME ZONE] date +%z but I need to run this on HP-UX, and the %z option of date is not supported. I have a data file which has a number of timestamps (in UTC), and for each of them a timezone is indicated, and I need to find t...

open() causes program termination

Hi, I use the following program to write to a fifo: #include <iostream> #include <fstream> #include <stdio.h> #include <stdlib.h> #include <string.h> #include <unistd.h> #include <fcntl.h> #include <sys/types.h> #include <sys/stat.h> using namespace std; int main() { unlink("fifo1"); if (mkfifo("fifo1", 0666) != 0) { ...

Why can't I read user input properly inside a UNIX while loop?

I'm using the bourne shell in UNIX, and am running into the following problem: #!/bin/sh while read line do echo $line if [ $x = "true" ] then echo "something" read choice echo $choice else echo "something" fi done <file.txt The problem I have here is that UNIX will not wait for user i...

In C, how can I create a file from a filepath, even if the directories are not existing?

I am taking a file path from a user. I need to then access that file, and create it if it does not exist. I also need to create any intermediate directories if they don't exist as well. For example, if my directory looks like: mydir | +---subdir | | | +-- FileA | +---File1 I might receive mydir/subdir/FileA and would then access ...

Problems after installing Ubuntu 10.10 on windows Vista

Hi folks, I just got done installing Ubuntu 10.10 on my Windows Vista as a separate partition and now my Vista wont boot (in fact I am not seeing an option to choose another OS, every time it defaults to Ubuntu) I really dont want to loose all my data on Vista. How do I get my Vista back? Steps I took: From Windows, Disk managem...

In Unix, is it possible to give getops a range of values to expect?

Sorry if the title is confusing, but here's what I mean: If I have a script that can accept several parameters, I'd use the getops command in order to more easily control script actions based on the parameters passed. However, lets say one of these parameters can be any number from 5 - 9, or whatever. Is there a way to tell getops that ...