Help answer threads with 0 replies.
Go Back > Forums > Non-*NIX Forums > Programming
User Name
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.


  Search this Thread
Old 09-26-2017, 02:01 AM   #1
LQ Newbie
Registered: Sep 2017
Location: Bay of Plenty, NZ
Distribution: Debian, Kali, Fedora
Posts: 22

Rep: Reputation: 0
Checksum program is throwing out an "file not found" error?

Hello, I'm new to this forum ( hope I'm allowed to say this as on stack-exchange I'm apparently not allowed to say hi or thanks :P ) Anyway I'm creating a simple program to do check-sums as I'm trying to get a hang of bash programming (so I can get a grasp of how things work before moving on to another language. So here is a chunk of my code
echo "Path to File?"
read Path
localsum=$(sha256sum $Path)
Now the trouble is whenever I get to this part it spits out an error saying
sha256sum '~/Downloads/pycharm-community-2017.2.3.tar.gz':No such file or directory
I have checked multiple times that this is the correct file even going so far as to type out the code into terminal to see what happens; it turns out fine, as predicted. So my quiestion is, what am I doing wrong?

Any help would be greatly appreciated
Thanks in advance, Fergus
Old 09-26-2017, 06:41 AM   #2
Senior Member
Registered: Oct 2011
Location: Budapest
Distribution: Debian/GNU/Linux, AIX
Posts: 3,535

Rep: Reputation: 1085Reputation: 1085Reputation: 1085Reputation: 1085Reputation: 1085Reputation: 1085Reputation: 1085Reputation: 1085
In this context, you cannot use ~tilde in the meaning of 'my home directory'.
Try this:

cat myscript
if [ -n "$1" ]; then
    echo "Path to File?"
    read Path
localsum=$(sha256sum "$Path") 
./myscript ~/Downloads/pycharm-community-2017.2.3.tar.gz

Last edited by NevemTeve; 09-26-2017 at 06:42 AM.
2 members found this post helpful.
Old 09-26-2017, 01:52 PM   #3
LQ Newbie
Registered: Sep 2017
Location: Bay of Plenty, NZ
Distribution: Debian, Kali, Fedora
Posts: 22

Original Poster
Rep: Reputation: 0
Oh cool, well I'v already written a the majority of my code and I've just tried an alternative: using /root/Downloads as my input instead! This worked so as this is for personal use only I'll just be doing that.

Thanks for the help, Fergus

Last edited by Fergupicus; 09-26-2017 at 01:57 PM.


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] X: "loading extension glx" "no screens found" "fatal server error" (w/ nvidia driver) Geremia Slackware 7 12-29-2014 11:00 AM
Valgrind is throwing error "failed in UME with error 22 (Invalid argument)." vamsi9042 Programming 1 11-06-2013 04:57 AM
[SOLVED] I get "'found module version 0, expected 9" Error while running a fortran 90 program. msbstar Linux - Newbie 4 09-16-2012 02:44 PM
FIX: wine error "No Program Start Menu Found" JackSmith Linux - Games 3 07-02-2009 10:38 PM
cedega install Diablo2 SuSE 91 "No program start menu found" error Drone91 Linux - Software 0 10-09-2005 12:55 PM > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 03:49 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration