tr: command not found

Any questions about the Command Line Interface can be placed here!
Forum rules
We've moved! Head over to Synology Community (community.synology.com) to meet up with our team and other Synology enthusiasts!
Lithium_Grim
Rookie
Rookie
Posts: 36
Joined: Thu Apr 29, 2010 10:50 am

tr: command not found

Unread post by Lithium_Grim » Wed May 19, 2010 9:22 pm

Ok so I'm a noob. I try to make a script to rename files to all uppercase.

Code: Select all

#!/opt/bin/bash 
for i in * 
do 
j=`echo $i | tr [:upper:] [:lower:]` 
mv $i $j 
done 
When i run the script I get the message tr: Command not found

I installed the bootstrap so I can use Bash, I checked /bin ... no tr, I checked /usr/bin .... no tr, checked /opt/bin .... no tr.

Can NE1 help?
DS410 with 4x 1,5 TB Samsung ECO Green

User avatar
maxxfi
Compiler
Compiler
Posts: 6794
Joined: Sun Dec 27, 2009 12:13 pm
Location: Espoo, Finland

Re: tr: command not found

Unread post by maxxfi » Wed May 19, 2010 10:15 pm

You need to install 'textutils' packages from ipkg:

Synold> ipkg files textutils
Package textutils (2.1-5) is installed on /opt/ and has the following files:
/opt/man/man1/comm.1
/opt/man/man1/nl.1
/opt/bin/md5sum
/opt/man/man1/unexpand.1
/opt/bin/nl
/opt/bin/tail
/opt/bin/od
/opt/bin/sum
/opt/man/man1/split.1
/opt/man/man1/tail.1
/opt/bin/head
/opt/man/man1/join.1
/opt/man/man1/uniq.1
/opt/man/man1/expand.1
/opt/man/man1/cksum.1
/opt/bin/cut
/opt/info/dir
/opt/bin/comm
/opt/man/man1/cut.1
/opt/bin/join
/opt/man/man1/od.1
/opt/bin/sha1sum
/opt/man/man1/sha1sum.1
/opt/man/man1/paste.1
/opt/bin/expand
/opt/bin/sort
/opt/bin/wc
/opt/bin/cat
/opt/bin/split
/opt/bin/tr
/opt/info/dir.old
/opt/man/man1/sort.1
/opt/bin/pr
/opt/bin/unexpand
/opt/man/man1/pr.1
/opt/man/man1/fmt.1
/opt/man/man1/fold.1
/opt/bin/cksum
/opt/bin/fmt
/opt/bin/tsort
/opt/bin/ptx
/opt/bin/uniq
/opt/bin/tac
/opt/info/coreutils.info
/opt/bin/paste
/opt/man/man1/md5sum.1
/opt/man/man1/cat.1
/opt/man/man1/tsort.1
/opt/bin/csplit
/opt/bin/fold
/opt/man/man1/csplit.1
/opt/man/man1/sum.1
/opt/man/man1/wc.1
/opt/man/man1/head.1
/opt/man/man1/ptx.1
/opt/man/man1/tac.1
/opt/man/man1/tr.1

Successfully terminated.
No longer using Synology NAS, moved to more open source solutions.
DS-106j > DS-210j > DS-411

Lithium_Grim
Rookie
Rookie
Posts: 36
Joined: Thu Apr 29, 2010 10:50 am

Re: tr: command not found

Unread post by Lithium_Grim » Thu May 20, 2010 5:41 am

Hmmm, must be doing something wrong:

Code: Select all

DiskStation> ipkg files textutils
Successfully terminated.
Collected errors:
Package textutils not installed.
Must I run the command from a certain directory?
DS410 with 4x 1,5 TB Samsung ECO Green

User avatar
maxxfi
Compiler
Compiler
Posts: 6794
Joined: Sun Dec 27, 2009 12:13 pm
Location: Espoo, Finland

Re: tr: command not found

Unread post by maxxfi » Thu May 20, 2010 6:12 am

Nope, it should run from any directory.
Maybe it's not able to write some temporary file somewhere?

EDIT: maybe a better explanation is that 'files' command works only if you have
the package already installed (as last line of your output may suggest)
No longer using Synology NAS, moved to more open source solutions.
DS-106j > DS-210j > DS-411

Lithium_Grim
Rookie
Rookie
Posts: 36
Joined: Thu Apr 29, 2010 10:50 am

Re: tr: command not found

Unread post by Lithium_Grim » Thu May 20, 2010 7:16 am

I guess that's the problem. What do I need to install for the 'files' command? Again, I'm a Noob.
DS410 with 4x 1,5 TB Samsung ECO Green

User avatar
maxxfi
Compiler
Compiler
Posts: 6794
Joined: Sun Dec 27, 2009 12:13 pm
Location: Espoo, Finland

Re: tr: command not found

Unread post by maxxfi » Thu May 20, 2010 9:19 am

To solve your basic problem with tr, you should install 'textuptils' package with:

Code: Select all

Synology> ipkg install textutils
After that, if you run 'ipkg files textutils' you should be able to see the conent of textutil package, and where tr is.

BTW: to find whether a certain command (e.g. tr) is installed (at least, if it's included under your command path), use the following:

Code: Select all

Synology> type tr
No longer using Synology NAS, moved to more open source solutions.
DS-106j > DS-210j > DS-411

Lithium_Grim
Rookie
Rookie
Posts: 36
Joined: Thu Apr 29, 2010 10:50 am

Re: tr: command not found

Unread post by Lithium_Grim » Thu May 20, 2010 9:28 am

Thanx a lot for your help. Will try it this afternoon. I beginning to see the logic.
DS410 with 4x 1,5 TB Samsung ECO Green

Locked

Return to “Command Line Interface”