- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- copy_files_in_dir.sh[12]: Syntax error at line 35 ...
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Discussions
Discussions
Forums
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО02-15-2011 04:43 PM
тАО02-15-2011 04:43 PM
copy_files_in_dir.sh[12]: Syntax error at line 35 : `(' is not expected
I am trying to run the file 'copy_files_in_dir.sh' and getting the error that - `(' is not expected. Could somebody help me please. Below is the content at line # 35.
mondate_pd=$echo $var | awk '{ printf "%s\n", substr( $1, 6, 6 ) }'
Please let me know if I need to provide more details.
Thanks & Regards,
Dhiraj
- Tags:
- quoting
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО02-16-2011 10:24 AM
тАО02-16-2011 10:24 AM
Re: copy_files_in_dir.sh[12]: Syntax error at line 35 : `(' is not expected
You want:
mondate_pd=$(echo $var | awk '{ printf "%s\n", substr( $1, 6, 6 ) }')
...in order to set the 'mondae_pd' variable. Notice the $(...)
Regards!
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО02-16-2011 10:31 AM
тАО02-16-2011 10:31 AM
Re: copy_files_in_dir.sh[12]: Syntax error at line 35 : `(' is not expected
Thanks & Regards,
Dhiraj
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО02-16-2011 10:39 AM
тАО02-16-2011 10:39 AM
Re: copy_files_in_dir.sh[12]: Syntax error at line 35 : `(' is not expected
There is nothing wrong with the corrected syntax I offered.
I should point out that the shell's reporting of the line number at which an error occurs is somewhat fuzzy. Generally, the error is reported a few lines after the real problem.
You can better expose things by running your script with tracing:
# sh -x ./myscript 2>&1|more
If you post your whole script it would be easier to resolve, too.
Regards!
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО02-16-2011 10:45 AM
тАО02-16-2011 10:45 AM
Re: copy_files_in_dir.sh[12]: Syntax error at line 35 : `(' is not expected
Thanks again.
Kind Regards,
Dhiraj
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО02-16-2011 11:29 AM
тАО02-16-2011 11:29 AM
Re: copy_files_in_dir.sh[12]: Syntax error at line 35 : `(' is not expected
Your script appears to have been mangled. The first problem is:
ls -ltr | grep : | grep -v "^d" | awk '{ print $6 "-" $7 " " $8 " " $9 }' | awk '//
...which occurs at line-24. There is no continuation of the last 'awk' script nor is the line itself continued
Regards!
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО02-16-2011 12:07 PM
тАО02-16-2011 12:07 PM
Re: copy_files_in_dir.sh[12]: Syntax error at line 35 : `(' is not expected
Thanks for your time to help me.
Kind Regards,
Dhiraj
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО02-16-2011 01:50 PM
тАО02-16-2011 01:50 PM
Re: copy_files_in_dir.sh[12]: Syntax error at line 35 : `(' is not expected
I found that in line 24, awk comand is required at the end since its followed by if else clause. There is awk '// at the end of line 24 but I guess only awk ' is required so I removed '//' part and ran the file but again same error. I am learning new things and trying to debug it again :). will let you if I find anything else till tomorrow.
Thanks & Regards,
Dhiraj
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО02-17-2011 08:52 AM
тАО02-17-2011 08:52 AM
Re: copy_files_in_dir.sh[12]: Syntax error at line 35 : `(' is not expected
I tried to get something out of the script but still I am getting the same error. Can you please help me out
Thanks & Regards,
Dhiraj
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО02-17-2011 10:51 AM
тАО02-17-2011 10:51 AM
Re: copy_files_in_dir.sh[12]: Syntax error at line 35 : `(' is not expected
> I tried to get something out of the script but still I am getting the same error. Can you please help me out
OK, disregard what I said originally. This is one seriously convoluted script.
Using the last post of your code. Change these lines as shown:
Change lines 35-36 from:
mondate_pd=$(echo $var | awk '{ printf "%s\n", substr( $1, 6, 6 ) }')
curr_yr=$echo `date -u` | awk '{ print $6}'
...to this:
mondate_pd=echo $var | awk '{printf "%s\n",substr\($1,6,6\)}'
curr_yr=echo `date -u` | awk '{ print $6}'
...and see if this solves your problem.
Regards!
...JRF...