Sponsored Content
Top Forums Shell Programming and Scripting Value Too Great for Base Error, Explanation and Workout needed Post 302875507 by gkelly1117 on Tuesday 19th of November 2013 04:42:43 PM
Old 11-19-2013
Quote:
Originally Posted by RudiC
bash takes numerical input with leading zeroes to be octal values, hence 8 & 9 are too great. You can either strip the zeroes or indicate the base by e.g. a leading 10# . man bash:
so 10#in front of my variable for time stamps would make it base 10 and eliminate the problem in its entirety?

going to try that now

---------- Post updated at 04:42 PM ---------- Previous update was at 04:39 PM ----------

Quote:
Originally Posted by Chubler_XL
Can I suggest you use %s format for your date output this gives seconds past epoch and will avoid the leading zero issue all together.

Code:
old_file()
{
    local dtcmp=`date -d "$1" +"%s"`; shift
    local today=`date -d "$*" +"%s"`
    (( dtcmp < today ))
}

As an example, the code you had was comparing 2008-12-22 and 2010-03-12 ==> 1974 and 1995
I wanted to use %s but was told for the way the way my boss wants it, to use %F it was his preference not mine.
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

sed command explanation needed

Hi, Could you please explain me the below statement -- phrase wise. sed -e :a -e '$q;N;'$cnt',$D;ba' abc.txt > xyz.txt if suppose $cnt contains value: 10 it copies last 9 lines of abc.txt to xyz.txt why it is copying last 9 rather than 10. and also what is ba and $D over there in... (4 Replies)
Discussion started by: subbukns
4 Replies

2. Shell Programming and Scripting

Windows driver needed for 1000 base tx card (HP)

First of all, excuse my ignorance in my questions, but truth is, I know nothing about Unix. I have recently purchased some A7012A's (dual port, 1000 base T/X) gigabit cards and need to use them in a windows environment. I am trying to see if it is possible to have drivers written for the card... (0 Replies)
Discussion started by: poaking
0 Replies

3. UNIX for Dummies Questions & Answers

Exec explanation needed

Hello! I want to read a file line by line and have each line in a variable. I have found the following code. #!/bin/bash exec 3< data while read <&3 do echo "The number is $REPLY" a.out "$REPLY" done exec 3>&- I don't understand the use of exec and its arguments, though having read... (3 Replies)
Discussion started by: myle
3 Replies

4. UNIX for Advanced & Expert Users

Which Base Level Filesets needed by a specific program?

hello... thats a great forum btw :) my problem is that I need a list of the Base Level Filesets (BLF) which are needed by a specific program. Is there any command/tool which shows me that? during the installation I can choose "Preview only" so that I can see what BLF´s are missing etc but... (4 Replies)
Discussion started by: cypher82
4 Replies

5. Solaris

showrev output explanation needed

hi this is the output of showrev command from my sun blade 150 machine. bash-3.00# showrev Hostname: u15_9 Hostid: 83685284 Release: 5.10 Kernel architecture: sun4u Application architecture: sparc Hardware provider: Sun_Microsystems Domain: sun.com Kernel version: SunOS 5.10... (1 Reply)
Discussion started by: kingston
1 Replies

6. Shell Programming and Scripting

Explanation Needed

Hi all, I'm very new to UNIX. I have got a coding, where i dont understand the below part. Could someone please explain it in detail? awk 'NR > 1; NR == 1 { S = $0 } END { print S }' $textfile.bak > $textfile could someone explain what awk 'NR > 1; NR == 1 { S = $0 } END { print S }' ... (1 Reply)
Discussion started by: raghulshekar
1 Replies

7. Programming

Python 3.1 TypeError explanation needed

Could someone explain why Python 3.1 errors out below? Do I need an additional module that's not required in 3.2 perhaps? I need to use 3.1 as it's the version available on a server I am using. Python 3.2.1rc1 (default, May 18 2011, 11:01:17) on linux2 Type "help", "copyright", "credits"... (0 Replies)
Discussion started by: jelloir
0 Replies

8. UNIX for Advanced & Expert Users

Grep - Explanation needed.

grep -E '^(++){5}5000' <file_name> this command searches value 5000 in only 6th column from provided file where pipe ( | )is delimiter which separate columns... can some one plz explain me what '^(++){5}5000' actually does..? :confused: (1 Reply)
Discussion started by: Killer420
1 Replies

9. Shell Programming and Scripting

Little explanation needed on array

I had gone through..google search.....and unix user post.......where I found so many ways of accessing files..... suppose if I am having 4 files, each file is having 3 columns, and I want to use each field of each column, then how can I use it.. how can I create array for each file's each column,... (8 Replies)
Discussion started by: Dona Clara
8 Replies

10. UNIX for Beginners Questions & Answers

Explanation for Scripts Inner Workings Needed

#!/bin/bash n=$l; typeset -a v x=$(< input.dat) check(){ if; then sed 's/Test/Proc/g' file.sh >fl.sh else exit 13 fi } check $n while ; do x=`expr $x -l` v=$x done less fi.sh l>/dev/null&& echo yes || exit 1 echo v= ${v } exit 0 I have file.sh and input.dat in the current... (3 Replies)
Discussion started by: bananasprite
3 Replies
DUPLY(1)							duply documentation							  DUPLY(1)

NAME
duply - a shell frontend to duplicity for simplified backups SYNOPSIS
duply profile create duply profile command [options ...] duply profile command[_command_...] [options ...] DESCRIPTION
Duply deals as a wrapper for the mighty duplicity magic. It simplifies running duplicity with cron or on command line by: - keeping recurring settings in profiles per backup job - enabling batch operations eg. backup_verify_purge - executing pre/post scripts for every command - precondition checking for flawless duplicity operation For each backup job one configuration profile must be created. The profile folder will be stored under ~/.duply/<profile> (where '~' is the current users home directory). Hint: If the folder /etc/duply exists, the profiles for the super user root will be searched and created there. USAGE
First time usage (profile creation): duply <profile> create General usage in single mode (see EXAMPLES): duply <profile> <command> [<options> ...] General usage in batch mode joining commands with '_' (see EXAMPLES): duply <profile> <command1>_<command2>[_<command3>...] [<options> ...] Non duply options are passed on to duplicity (see OPTIONS). All conf parameters can also be defined in the environment instead. PROFILE
location for profiles Indicated by a profile name i.e. sample, which is resolved to ~/.duply/sample ('~' expands to environment variable $HOME). Superuser root can place profiles under /etc/duply if the folder is manually created before running duply. ATTENTION: If /etc/duply/ is created, old profiles under /root/.duply/ have to be moved manually to the former or will cease to work. using profiles Usually only the profile name will be used: duply humbug backup Alternatively a path might be used. This might be useful for quick testing, restoring or exotic locations. Shell expansion should work as usual: duply ~/.duplytest/humbug backup ATTENTION: The path must contain at least one '/', e.g ./test instead of only test. COMMANDS
usage Get usage help text. create Creates a configuration profile. backup Backup with pre/post script execution (as batch the same as: pre_bkp_post) o as full backup if parameter full_if_older matches or no earlier backup is found. o as incremental backup in all other cases. bkp As above but without executing pre/post scripts. full Force full backup. incr Force incremental backup. pre Execute only script '<profile>/pre' (for debugging purposes). post Execute only script '<profile>/post' (for debugging purposes). list [age] List all files in backup (as it was at age, default: now). status Prints backup sets and chains currently in repository. verify List files changed since latest backup. purge [--force] Shows outdated backup archives (older than $MAX_AGE). Option --force delete these files. purge-full [--force] Shows outdated backups (more than $MAX_FULL_BACKUPS), the number of recent full backups and associated incrementals to keep. Option --force delete these files. cleanup [--force] Shows broken backup archives (e.g. after unfinished run). Option --force delete these files. restore target_path [age] Restore the backup to target_path (as it was at age). fetch src_path target_path [age] Restore single file/folder from backup (as it was at age). OPTIONS
--force Passed to duplicity (see commands: purge, purge-full, cleanup). --preview Do nothing but print out generated duplicity command lines. --disable-encryption Disable encryption (does override profile settings). PRE
/POST SCRIPTS All internal duply variables will be readable in the scripts. Some of interest might be CONFDIR, SOURCE, TARGET_URL_<PROT|HOSTPATH|USER|PASS>, GPG_<KEYS_ENC|KEY_SIGN|PW>, CMD_<PREV|NEXT> The CMD_* variables were introduced to allow different actions according to the command the scripts were attached to e.g. 'pre_bkp_post_pre_verify_post' will call the pre script two times, but with CMD_NEXT variable set to 'bkp' on the first and to 'verify' on the second run. EXAMPLES
Create profile 'humbug': duply humbug create and then edit the resulting conf file of this profile. Backup 'humbug' now: duply humbug backup List available backup sets of profile 'humbug': duply humbug status List and delete obsolete backup archives of 'humbug': duply humbug purge --force Restore latest backup of 'humbug' to /mnt/restore: duply humbug restore /mnt/restore Restore /etc/passwd of 'humbug' from 4 days ago to /root/pw: duply humbug fetch etc/passwd /root/pw 4D See man duplicity, section TIME FORMATS for the time format. A one line batch job on 'humbug' for cron execution: duply humbug backup_verify_purge --force FILES
Files in the profile folder(~/.duply/<profile>): conf .......... main profile configuration file pre ........... pre script (see above for details) post .......... post script (see above for details) gpgkey.*.asc .. exported GnuPG key file(s) exclude ....... a globbing list of included or excluded files/folders The rules for the exclude file can be found in man duplicity, section FILE SELECTION). IMPORTANT
Copy the whole profile folder after the first backup to a safe place. It contains everything needed to restore your backups. You will need it if you have to restore the backup from another system (e.g. after a system crash). Keep access to these files restricted as they contain all information (gpg data, ftp data) to access and modify your backups. Repeat this step after all configuration changes. Some configuration options are crucial for restoration. BUGS
This program is still in development. If you find bugs write a bug report on: http://sourceforge.net/projects/ftplicity/. AVAILABILITY
For newer versions see http://sourceforge.net/projects/ftplicity/. COPYRIGHT and LICENSE Copyright (C) 2006 Christiane Ruetten, 2008-2011 Edgar Soldin This package is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. On Debian systems, the complete text of the GNU General Public License version 2 can be found in the file `/usr/share/common-licenses/GPL-2'. AUTHOR
Duply was written by Christiane Ruetten (initial version, named ftplicity) and Edgar Soldin. This manual page was written by Joachim Wiedorn <ad_debian at joonet.de> for the Debian project (and may be used by others). SEE ALSO
duplicity(1) Version 1.5.5 2011-09-06 DUPLY(1)
All times are GMT -4. The time now is 01:59 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy