Configuration Information [Automatically generated, do not change]: Machine: x86_64 OS: Linux-gnu Compiler: gcc Compilation CFLAGS: Compilation CFLAGS: -DPROGRAM='bash' -DCONF_HOSTTYPE='x86_64' -DCONF_OSTYPE='linux-gnu' -DCONF_MACHTYPE='x86_64-pc-linux-gnu' -DCONF_VENDOR='pc' -DLOCALEDIR='/usr/share/locale' -DPACKAGE='bash' -DSHELL -DHAVE_CONFIG_H -I. -I../bash $/bash -I../bash/include -I../bash/lib -g -O2 -Wall uname output: Linux wiggum-v5 2.6.32-5-amd64 #1 SMP Fri May 10 08:43:19 UTC 2013 x86_64 GNU/Linux Machine Type: x86_64-pc-linux-gnu
Bash Version: 4.1
Patch Level: 5
Release Status: release
Description:
The bash script compiles and runs just fine when running it via
command line (./script_name). However what I want to do is only run the script
if it has not been run that day. I also want to run this whenever a terminal is
opened up so I call the script within .bashrc. When ran from .bashrc I get the
error (path of script): 7 : Bad substitution. The script runs fine without
calling from .bashrc (it is the last line in the .bashrc file).
Repeat-By:
Replicating the code I have below. You will then want to call
this script via the bottom of the .bashrc file ( sh [path to script here] ).
#!/bin/bash
current_date=$(date +%Y-%m-%d)
modded_date=$(stat -c %z /home/dev/login_startup)
#Line that generates the error
trial=${modded_date:0:10}
echo $trial
echo $current_date
#More stuff down here
If you have any questions feel free to email me. I hope I explained everything
clearly, thanks for taking the time to read this!
Zak Williams
HP Tools Team Intern
[HP]<http://www.hp.com/>
<<inline: image001.png>>
