[Webinar] Learn how to a build a cloud-first strategyRegister Now


Help troubleshoot Linux Shell scripts

Posted on 2011-10-12
Medium Priority
Last Modified: 2012-05-12

This question is related to past EE thread ids below:

Kindly refer to them 1st;  believe they're related but somehow
I can't figure out why the dos2unix conversion can't locate the
md5 checksum file.  It works for sftp put scripts though (as fixed
by the EE expert in the above thread ids), just that this sftp get
script did not work despite I implement the suggestion given above.
Perhaps I miss something

scr1.sh calls sftp_get_from_rem.sh
but somehow the dos2unix conversion in sftp_get_from_rem.sh
did not work.  Inserting dos2unix in scr1.sh would work

Refer to attached

Question by:sunhux
  • 2
LVL 20

Accepted Solution

simon3270 earned 2000 total points
ID: 36956644
I've tried this and it seems to work on my ubuntu machine - hte .md5 fie is successfully converted by sftp_get_from_rem.sh.

Please add this just before the unix2dos lines:
    echo $LOCAL_DIR/$FILE_NAME.md5
    echo ls -l $LOCAL_DIR/*
    echo file $LOCAL_DIR/*

Open in new window

Then show us what is in the log file (sanitised for passwords etc if necessary).

Author Comment

ID: 36998064

Just realized I'm using a non-root UNIX id to run the script & the
dos2unix / unix2dos is not in this id's PATH.  So I'll need to prefix
the path for the dos2unix command.

Sorry, thanks for responding.

Author Closing Comment

ID: 36998065

Just a point to note is that in one other script, I forgot to
prefix the datafile with $LOCAL_DIR  so it should be

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Using libpcap/Jpcap to capture and send packets on Solaris version (10/11) Library used: 1.      Libpcap (http://www.tcpdump.org) Version 1.2 2.      Jpcap(http://netresearch.ics.uci.edu/kfujii/Jpcap/doc/index.html) Version 0.6 Prerequisite: 1.      GCC …
FreeBSD on EC2 FreeBSD (https://www.freebsd.org) is a robust Unix-like operating system that has been around for many years. FreeBSD is available on Amazon EC2 through Amazon Machine Images (AMIs) provided by FreeBSD developer and security office…
Learn how to get help with Linux/Unix bash shell commands. Use help to read help documents for built in bash shell commands.: Use man to interface with the online reference manuals for shell commands.: Use man to search man pages for unknown command…
Learn how to find files with the shell using the find and locate commands. Use locate to find a needle in a haystack.: With locate, check if the file still exists.: Use find to get the actual location of the file.:
Suggested Courses
Course of the Month20 days, 10 hours left to enroll

867 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question