Programming :: Subtracting Years From Current Year?
Feb 24, 2011
I have a script: Code: #!/bin/bash
THEYEAR=2011
LASTYEAR=$(($THEYEAR - 1))
echo $THEYEAR
echo $LASTYEAR I get:
[Code]...
THEYEAR is correct but then I get a line space and then a -1 for LASTYEAR. I can't figure out why.
View 2 Replies
ADVERTISEMENT
Mar 17, 2010
I am using Red hat Linux operating system.I want change the date exactly 5 years ago to current date with out providing month, date and time. I want only the year should be 5 years ago .please help in this regard . example . If current date is this = Wed mar 18 22:59:23 IST 2010. past date shuld be like this= Sat Mar 18 22:59:23 IST 2005
View 6 Replies
View Related
Jul 28, 2011
I am using timersub to subtract two timers but the result is not what I would expect.
* My code *
struct timeval best_acquisition_time, best_at, temp_time1;
best_acquisition_time.tv_sec = 1311826027;
best_acquisition_time.tv_usec = 0;
best_at.tv_sec = 1311826026;
best_at.tv_usec = 741835;
timersub(&best_at, &best_acquisition_time, &temp_time1);
* End of Code *
When I inspect temp_time1 after timersub executes the result is:
temp_time1.tv_sec = -1;
temp_time1.tv_usec = 741835;
I expected:
temp_time1.tv_sec = 0;
temp_time1.tv_usec = -258165;
View 3 Replies
View Related
Jul 1, 2011
In the MySQL database for one of my programming projects, I used a "YEAR(4)", because I wanted the column to contain four-digit year values. I discovered, though, that this type only allows values from 1901 to 2155, which is not workable as some year values are previous to the twentieth century. But I do not want a "DATE" type because the month and day are of no interest to me. What type should I convert to that would be the least radical change in data type, while giving more range?
View 1 Replies
View Related
Jan 31, 2011
I have a folder of 2 many files that the old ls just hangs.
I am trying to write some log files such as;
I don't mind doing one at a time, but I am just playing and even getting the listing I am not getting the date stamp, I have the following;
That does create the file, but all the files look like this;
So basically it's just sticking that ls inside the log file and not actually running the ls, so how can I use the above type to get files just created per year?
View 2 Replies
View Related
Feb 10, 2011
Interesting uh? For example, 2 days ago's date is 2011 Feb 8th. This is not a homework...
View 3 Replies
View Related
Aug 23, 2010
I have VirtualBox on my Windows 7. I have Ubuntu running for years on a 1TB hard drive. I put the hard drive on my Windows 7 and Computer Management see it as "Disk 0" my Windows 7 drive is "Disk 1" The Disk 0 don't have a drive letter. I only see it in My computer manage.How do I get VirtualBox to boot my Ubuntu hard drive that all ready has Ubuntu install and all set up on it?
View 3 Replies
View Related
Aug 4, 2010
I have tried using Linux several times but to be truthful it just seemed to be so complicated when compared to windows OS's That it just never really appealed. The one thing That really annoys me about Linux is that Widows makes it so easy to connect to the internet and even if you run into a problem nearly every Provider offers support for Win users.
My provider BigPond (Australia) Solves all Win OS problems with just a simple phone call, but when I say LInux " Sorry We don't support that system." is the reply. So! My cable modem is supplied by BigPond but when I try to log in using Ubuntu 10.4 : Nothing works. Linux just can't recognise the hardware and no one seems to be able to tell me how you you link Ubuntu to your normal Internet hardware.
Why is it so difficult for Linux users to do what is just a breeze for Windows users. Until Linux can match Microsoft in user friendly competition, it will always run a dismal Last to Windows in any form and Win 7 is just such an easy to use service. So is there anyone out there who can tell me how I get Ubuntu to recognize my Modem and at least get me started?
View 14 Replies
View Related
Apr 5, 2010
Planning to return to suse after a gap of two years. Is anyone using xephem and gcompris. Or can some one submit the link for how to install of these programmes.
View 3 Replies
View Related
Jul 9, 2010
I have been away from linux for some years, but now I'm once again back with Ubuntu 10.04. I used to run Gentoo in 2000 and knew my commands, but now that the world of linux has progressed a bit further, aren't there many new commands to learn? Do you know a list of linux shell commands that are in broad use now and which didn't exist 10 years ago?
View 12 Replies
View Related
Feb 2, 2011
i used to used edonkey2000 a vouple of years a go until i got to know bittorrent
i installed mldonkey
# aptitude install mldonkey-gui
run, and then what? no servers list.
View 3 Replies
View Related
Apr 20, 2010
Since I can remember, Logout sound never plays in Ubuntu, or maybe the problem is Compiz + Gnome. A very similar problem occurs in KDE (Kubuntu), but here the problem is No Login sound.
Gnome + Compiz: Good Login sound, No Logout sound.
KDE: No Login Sound, good Logout sound.
So, what is the problem with Login/Logout sounds in Linux now? I have used the last 4 Ubuntu releases, and Logout sound never plays in Ubuntu(gnome).How could a fix that?
View 1 Replies
View Related
Apr 25, 2010
Is it still true that if I install the LTS version of Kubuntu that I'll be stuck with the versions of software that it comes with? Or, will the versions of the software it comes with be updated during the three years it's good for?
Can I convert my present install of Kubuntu 9.10 to Kubuntu 9.10 LTS by installing Synaptic and clicking on Settings>Updates>Long>term>support>releases>only? I'd prefer using the 10.04 LTS version but not if I'll be stuck with software I can't upgrade.
View 3 Replies
View Related
Mar 4, 2010
I'd like to announce the release of cmus 2.3.0 here. cmus 2.3.0 features gapless MP3 playback, native PulseAudio output plugin (which cures all the problems with PA ALSA emulation present in 2.2.0), very fast metadata cache and much improved compilations handling.
Not to mention tons of bugfixes since 2.2.0, which was released almost 3 years ago.[URL]..
View 1 Replies
View Related
Apr 2, 2010
I've been trying to install module em28xx in a Slackware 12.0 installation that has been operating for several years. This is the em28xx that is part of the Slackware 12.0 distribution itself (kernel 2.6.21.5).
Unfortunately, although em28xx is fine, modprobe has a problem with dependent module i2c-core, which is generating an "Invalid module format" message. The system is using the generic Slackware 12.0 kernel, not the huge kernel.
View 7 Replies
View Related
Nov 15, 2010
Got directories dated of 2009 2008, What is the best way to ls the directories, sort them by date, redirect the output to a file and then delete them?
View 14 Replies
View Related
Jun 7, 2011
I am writing this because I want to keep all of the things that I have now on my ubuntu 10.
4 computer and do not want to upgrade until I have some way of keeping all of the things that I currently have on it.Sohow so I make this happen? Should I try to load these program settings on a flash drive?
View 1 Replies
View Related
Feb 11, 2011
I have to write a script that says Hello, [current user]. Today is [date]. The time is [time am/pm]. You have logged into a [term] terminal.My script looks like this:
DOW=`date +%A`
MOY= `date +%B`
DOM= `date +%d`
[code]....
View 1 Replies
View Related
Dec 8, 2010
Code:
#if defined(WIN32) || defined(WIN64)
#define WINDOWS
#endif
[code]....
what is the directive thats required to detect a linux system? i want to to be able to detect which platform im compiling on automatically.
View 5 Replies
View Related
Jun 18, 2010
I'm looking for a function (prefer POSIX, but Linux specific would do if it has to) to get the current timezone offset. For my location, eastern USA, that should be -14400 when daylight time is in effect, and -18000 otherwise.
View 1 Replies
View Related
Jun 28, 2010
Detect the current window that has the focus. For example at the moment am using firefox therefore teh function should say firefox is the main window.
View 2 Replies
View Related
Feb 14, 2011
When I run:make -f mymakefile clean I get:rm -f mybinary *.so.* *.dep *.o mybinary.symand all the above files are removed from the current directory.But I have a directory /src/ where I have all my source files located. The *.o file in this directory are not removed?
View 4 Replies
View Related
Oct 20, 2010
how to pipe the current directory listing into sort so that the output is the date in descending order (primary sort key). If there are multiple entries with the same date, I'd like the times sorted in ascending order. It seems simple but for some reason this isn't working:
ls -l | sort -k 6r -k 7
For some reason it doesn't seem to ever get to the second sort key when using column 6 (last modified date).
View 2 Replies
View Related
Jan 17, 2010
Actually I suppose to use this "htop" command to get the system utilities like current processor speed ,running programs ,memory usage(ram and swap) to my program. I planned to get it using popen(). I was success popen("top | grep Mem", "r") with top command. But are there a way to take such information using "htop". Or are there any idea of taking current CPU,MEM,Swp usage as well as Tasks and running tasks using htop or other way to C program...
View 1 Replies
View Related
Feb 15, 2010
How to list only hidden files in current directory ?
View 2 Replies
View Related
May 13, 2010
I noticed there's a new JRE in town, the upgrade 20, I still use the 13. What will the up to 20 do for the software I write? I use openJDK (came with the Fedora I use) to write software, and the JRE to use it in the browser, I needed to see the Java console, hence the need for the Sun JRE...
So: bottomline: if I upgrade to the new JRE - use the alternatives configurator to use that in the browser, will the software written in the current JDK (1.6) still work? Or: is Java downward compatible?
PS : I dont use anything fancy, just RMI, mySQL connectivity and a bit of Swing...
View 1 Replies
View Related
Dec 22, 2010
I've got some bash scripts that I'm testing which operate on different screen sessions under different usernames. In order to check the status of them, however, I have to attach the screen sessions to my current terminal.
I run into problems, though; I only allow SSH to my machine from one username; the others shouldn't need SSH access. So, I log in as one user, and su into whichever user I need. Without performing a chmod o+rw on the terminal before I su into a different user, screen complains that it can't reattach to my terminal, because the user trying to make it attach doesn't have the permissions to do so.
Seeing as I forget to do this a lot, I wanted to make a script that I'd run on log-in to do this for me. Unfortunately, I don't know if there's a bash variable that refers to the current terminal - I can't always guarantee that I'll be logging in to /dev/pts/0, especially if my internet connection gets cut and I leave a hanging terminal...
Is there a variable for that or a way to refer to it in a script? If not, how do I work around that?
View 4 Replies
View Related
Jan 12, 2011
What functions are available on linux for a c++ program to determine if the current user is a member of a specific user group?
View 3 Replies
View Related
Dec 25, 2010
How can I print the current time of my system with a batch file. My os is ubuntu.
View 4 Replies
View Related
May 2, 2010
how can i actually switch to another directory with "chdir" in perl.like the we used to do is bash as:
Code:
$cat abc
cd Desktop/
[code]...
View 1 Replies
View Related