Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.debian.user > #205943
| From | deb <deb@rangingthoughts.org> |
|---|---|
| Newsgroups | linux.debian.user |
| Subject | Bash file to variable string problem -- must be simple. What am I missing? |
| Date | 2019-03-03 02:00 +0100 |
| Message-ID | <xxnDY-5kl-9@gated-at.bofh.it> (permalink) |
| Organization | linux.* mail to news gateway |
[Multipart message — attachments visible in raw view] - view raw
This has to be simple and I'm just missing it. If I pull a filename from a temp file into a variable, I can *ls* it fine. If I cut off the extension, and tack on my own SAME EXT, *ls* no longer works. (The actual script is more elaborate, loading *vlc* , etc -- but this summarizes & shows my issue) # mp4file.txt holds just '*long file with spaces.mp4'* * * fname=$(<mp4file.txt) # echo $fname shows the right filename.mp4 string # works ls -al "$fname" # Cut off the extension. fname=`echo $fname | rev | cut -d. -f2 | rev` # echo $fname shows the filename sans '.mp4' # THIS LS FAILS, WITH FILE NOT FOUND (but actually reports the exact string that worked above, but not being found here). *ls -al "$fname".mp4** * *ls: cannot access 'long file with spaces.mp4': No such file or directory * ------------------------------------------------------ It is not: * a special character thing, * a carriage return thing, * a character case thing, * not helped with './' or '~/' added in front of the filename. * It's the same string in both spots. Any thoughts folks? Thanks
Back to linux.debian.user | Previous | Next — Next in thread | Find similar | Unroll thread
Bash file to variable string problem -- must be simple. What am I missing? deb <deb@rangingthoughts.org> - 2019-03-03 02:00 +0100
Re: Bash file to variable string problem -- must be simple. What am I missing? Roberto C. Sánchez <roberto@debian.org> - 2019-03-03 02:10 +0100
re: Bash file to variable string problem -- must be simple. What am I missing? deb <deb@rangingthoughts.org> - 2019-03-03 03:50 +0100
re: Bash file to variable string problem -- must be simple. What am I missing? "der.hans" <deb-user@LuftHans.com> - 2019-03-03 04:40 +0100
[SOLVED] Re: Bash file to variable string problem -- must be simple. What am I missing? deb <deb@rangingthoughts.org> - 2019-03-03 16:10 +0100
Re: Bash file to variable string problem -- must be simple. What am I missing? David Wright <deblis@lionunicorn.co.uk> - 2019-03-03 06:10 +0100
Re: Bash file to variable string problem -- must be simple. What am I missing? "Thomas Schmitt" <scdbackup@gmx.net> - 2019-03-03 08:50 +0100
Re: Bash file to variable string problem -- must be simple. What am I missing? David Wright <deblis@lionunicorn.co.uk> - 2019-03-03 16:40 +0100
Re: Bash file to variable string problem -- must be simple. What am I missing? "Thomas Schmitt" <scdbackup@gmx.net> - 2019-03-03 18:50 +0100
Greg: Re: Bash file to variable string problem -- must be simple. What am I missing? deb <deb@rangingthoughts.org> - 2019-03-04 14:40 +0100
Re: Bash file to variable string problem -- must be simple. What am I missing? Greg Wooledge <wooledg@eeg.ccf.org> - 2019-03-04 14:40 +0100
[SOLVED II] (Thomas) Re: Bash file to variable string problem -- must be simple. What am I missing? deb <deb@rangingthoughts.org> - 2019-03-03 19:20 +0100
Re: Bash file to variable string problem -- must be simple. What am I missing? "Thomas Schmitt" <scdbackup@gmx.net> - 2019-03-03 22:50 +0100
Re: Bash file to variable string problem -- must be simple. What am I missing? David Wright <deblis@lionunicorn.co.uk> - 2019-03-04 09:40 +0100
David - Re: Bash file to variable string problem -- must be simple. What am I missing? deb <deb@rangingthoughts.org> - 2019-03-04 15:10 +0100
Re: David - Re: Bash file to variable string problem -- must be simple. What am I missing? Greg Wooledge <wooledg@eeg.ccf.org> - 2019-03-04 15:40 +0100
csiph-web