![]() |
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Error: `mv olddir/ newdir/ ` never works on new version of bash? | meili100 | UNIX for Dummies Questions & Answers | 5 | 02-20-2008 04:56 PM |
| Works from bash prompt, but not from script! | siegfried | Shell Programming and Scripting | 7 | 02-10-2008 02:56 PM |
| Substring in Shell Script | smartbuddy | UNIX for Dummies Questions & Answers | 3 | 08-17-2007 10:26 AM |
| Using variable with cp command in bash shell | maheshsri | Shell Programming and Scripting | 4 | 12-04-2006 01:30 PM |
| command for CPU online/offline status in bash shell | sars | UNIX for Advanced & Expert Users | 5 | 11-30-2006 06:10 PM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
substring command works but only in BASH shell
I am having trouble running a .sh file. The code 'x=${file_name:0:$z-11}' is giving me a bad substitution error. However when I run in BASH it works. Thing is when this goes to production the .sh will not be running in BASH. Is there a way to substring a string not in BASH or a way to invoke BASH and still run the .sh without any pauses. Thanks!
file_name="12366293address.txt" #Grabs length of file_name string z=${#file_name} #Substrings file_name x=${file_name:0:$z-11} |
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|