[Xperia Z General] viking666:
I think that expecting 'adb' to be in a particular place is not the best idea.

I have 'adb' installed, but not in "/opt/android-sdk/platform-tools/". So I modified the ADB="..." line in the script to be

ADB=`which adb`

Although this requires adb to be installed somewhere in your $PATH. A possible enhancement might be to use `which adb` with a fall-back to asking the user where adb is installed.

---------- Post added at 09:35 PM ---------- Previous post was at 09:27 PM ----------

Hmmm....

I ran the script and got the following output:

viking$ ../Backup-TA.sh

[ ------------------------------------------------------------ ]
[ Backup TA vL1.0 for Sony Xperia MIT License ]
[ ------------------------------------------------------------ ]
[ Copyright (C) 2013 DevShaft ]
[ ]
[ Permission is hereby granted, free of charge, ]
[ to any person obtaining a copy of this software ]
[ and associated documentation files (the "Software"), ]
[ to deal in the Software without restriction, ]
[ including without limitation the rights to use, ]
[ copy, modify, merge, publish, distribute, sublicense, ]
[ and/or sell copies of the Software, and to permit ]
[ persons to whom the Software is furnished to do so, ]
[ subject to the following conditions: ]
[ ]
[ The above copyright notice and this permission notice ]
[ shall be included in all copies or substantial portions ]
[ of the Software. ]
[ ]
[ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY ]
[ KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE ]
[ WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR ]
[ PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS ]
[ OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR ]
[ OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR ]
[ OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE ]
[ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ]
[ ------------------------------------------------------------ ]
Press any key to continue…

[Lots of empty lines]

[ ------------------------------------------------------------ ]
[ Backup TA vL1.0 for Sony Xperia MIT License ]
[ ------------------------------------------------------------ ]
[ Initialization ]
[ ]
[ Make sure that you have USB Debugging enabled, you do ]
[ allow your computer ADB access by accepting its RSA key ]
[ (only needed for Android 4.2.2 or higher) and grant this ]
[ ADB process root permissions through superuser. ]
[ ------------------------------------------------------------ ]
Starting adb and waiting for phone in USB Debugging Mode…
OK
Pushing Backup TA Tools… OK !
Checking for SU binary… OK : Su found at /system/xbin/su
Requesting root permissions… OK : Got Root permissions.

[Lots of empty lines]

[ ------------------------------------------------------------ ]
[ Backup TA vL1.0 for Sony Xperia MIT License ]
[ ------------------------------------------------------------ ]
[ Choose an option : ]
[ 1) Backup ]
[ 2) Restore ]
[ 3) Restore dry-run - nothing will be written on partition ]
[ 4) Convert TA.img to backup ]
[ 5) Quit ]
[ ------------------------------------------------------------ ]
scripts/utils.sh: line 37: read: 0.1: invalid timeout specification
=======================================
BACKUP
=======================================
When you continue Backup TA will perform a backup of the TA partition.
First it will look for the TA partition by its name. When it can not
be found this way it will ask you to perform an extensive search.
The extensive search will inspect many of the partitions on your device,
in the hope to find it and continue with the backup process.

scripts/utils.sh: line 37: read: 0.1: invalid timeout specification
Are you sure? [y/N] y
=======================================
Searchin TA Partition…
Partition not found by name.
scripts/utils.sh: line 37: read: 0.1: invalid timeout specification
Do you want to perform an extensive search for the TA ? [y/N] y
=======================================
Inspecting Partitions…
--- mmcblk0p1 ---
\e[KThis is a compatible TA Partition !figuration…
--- mmcblk0p2 ---
\e[KThis is not a TA Partition.entifier…
--- mmcblk0p3 ---
\e[KThis is not a TA Partition.entifier…
--- mmcblk0p4 ---
\e[KThis is not a TA Partition.entifier…
--- mmcblk0p5 ---
\e[KThis is not a TA Partition.entifier…
--- mmcblk0p6 ---
\e[KThis is not a TA Partition.entifier…
--- mmcblk0p7 ---
\e[KThis is not a TA Partition.entifier…
--- mmcblk0p8 ---
\e[KThis is not a TA Partition.entifier…
--- mmcblk0p9 ---
\e[KThis is not a TA Partition.entifier…
--- mmcblk0p10 ---
\e[KThis is not a TA Partition.entifier…
--- mmcblk0p11 ---
\e[KThis is not a TA Partition.entifier…
--- mmcblk0p12 ---
\e[KThis is not a TA Partition.entifier…
--- mmcblk0p13 ---
\e[KThis is not a TA Partition.entifier…
--- mmcblk0p14 ---
\e[KThis is not a TA Partition.entifier…
--- mmcblk0p15 ---
\e[KThis is not a TA Partition.entifier…
--- mmcblk0p18 ---
\e[KThis is not a TA Partition.entifier…
--- mmcblk0p19 ---
\e[KThis is not a TA Partition.entifier…
--- mmcblk0p20 ---
\e[KThis is not a TA Partition.entifier…
--- mmcblk0p21 ---
\e[KThis is not a TA Partition.entifier…
--- mmcblk0p22 ---
\e[KThis is not a TA Partition.entifier…
Partition found : /dev/block/mmcblk0p1
An unknown error was caught : partition is not set. Aborting…
=======================================
Backup unsuccessful
Cleaning working directory…
Removing files from Android…
Killing ADB Daemon… OK, exiting now !

If you're using ANSI colour sequences, don't. Colour is all well and good, but (as in my case) may not be totally compatible across platforms.

Now, the backup may have failed because my poor phone has had a "rough life" (Stock Sony ROM -> CM10.2 -> FreeXperia -> Stock Sony ROM) and I may have "lost" my TA partition somewhere along the line. Let me restore the backup I made and see what happens.