Sponsored Content
Top Forums Shell Programming and Scripting Look for, backup and delete symlinks Post 302692471 by Phil3759 on Monday 27th of August 2012 04:50:56 PM
Old 08-27-2012
Quote:
Originally Posted by Chubler_XL
You could use a case statement to match the "busybox" string:

Code:
case "$gnr" in
    *busybox*)
                ....
    ;;
    *)
               ....
    ;;
esac

Thank you a lot for the support

Using case in: again, no advantage over grep, as both are external commands to the shell. Using Grep permits me to continue with the if/else structure
Any other way to replace this part of code:
Code:
if [[ $gnr == *busybox ]]

By the way, I tried also this one:
Code:
if [ $gnr = "$bbpath/busybox" ];

But it ends detecting all symlinks as related to busybox, even those that are not related to it. Any reason you see for that?

Should I try
Code:
if [[ $gnr = "$bbpath/busybox" ]];

?

Quote:
Think you are going to have to resort to rebuilding the tar with your new/replaced files:
  • Extract existing tar archive into a temp area
  • copy additional/replacement files into same structure
  • retar the whole thing
  • delete the temp area.

---------- Post updated at 09:54 AM ---------- Previous update was at 09:48 AM ----------

Don't think ${f:1} is supported under ash you man need to use ${f#?} instead.
Did not think at it that way, good idea :-)

Edit:
${f:1} worked fine under /bin/sh (android) and also with the busybox ash I use actually. But thank you for the other alternative

Last edited by Phil3759; 08-27-2012 at 05:59 PM..
 

10 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

search and replace symlinks

Hello All, Assuming i have a thousand symlinks under directory /mydir (and its sub-dir) such as: mysymlink1 -> ../../../myfoo/mysymlink1 mysymlink2 -> ../../../myfoo/mysymlink2 How can I search the string "myfoo" and replaced with "yourfoo" such that after the operation is complete the... (2 Replies)
Discussion started by: nixrock
2 Replies

2. Shell Programming and Scripting

Nested Symlinks?

Please don't laugh or call me a fool... I'm trying to set up a script that will go through my Music File directory and generate a set of symbolic links in a directory called "What's New". Within that directory there will be a "30 Days", "3 Months", "6 Months" and "A Year" directories. Within... (0 Replies)
Discussion started by: deckard
0 Replies

3. UNIX for Dummies Questions & Answers

Symlinks

Given a filename, is it possible to know haow many symbolic links are pointing to it? How can I tell? (1 Reply)
Discussion started by: ct1977
1 Replies

4. Slackware

Context dependent symlinks

Ive got multiple PCs, sharing an NFS mounted home dir. For certain apps I would like to keep the config files host specific. Easy solution is to create symlinks to local folders for configs. Ideally I would still want the .config files to reside in the user home folder. Is it possible to... (2 Replies)
Discussion started by: agentrnge
2 Replies

5. Shell Programming and Scripting

scripts to Initialise,backup,restore,delete and empty

you are to write scripts for a customer that would require a system enable the backing up of files and directories. The script should (these names should be used): 1. INITIALISE: Initialise the directory for the backup(called backup and should be in the home directory) and any other... (1 Reply)
Discussion started by: babby01
1 Replies

6. Shell Programming and Scripting

rsync backup mode(--backup) Are there any options to remove backup folders on successful deployment?

Hi Everyone, we are running rsync with --backup mode, Are there any rsync options to remove backup folders on successful deployment? Thanks in adv. (0 Replies)
Discussion started by: MVEERA
0 Replies

7. Shell Programming and Scripting

Script - Mysql backup and delete

Hello I have a production mysql server and archive server, unfortunitly its not possible to setup repliacation between the two, the reason is that the archive server is using some fancy storage engine which doesn't allow mysql replication. I'm trying to write a script using perl that does... (1 Reply)
Discussion started by: amlife
1 Replies

8. Shell Programming and Scripting

Find + Symlinks = me confused

So i have read the man pages a few time. Searched google but I am not quite sure i understand all the lingo. What i want to do is list all files on / except i dont want any symlinks (because if I am searching / I will find the "true" file...correct?) So there is the -P, -H, and '-type l'... (2 Replies)
Discussion started by: nitrobass24
2 Replies

9. Shell Programming and Scripting

Find, backup and delete.

Is there any error while executing this script.. #!/bin/bash FINDPATH=/home/ftpcdr/cdr/192.168.3.91 BACKPATH=/home/ftpcdr/backup STATUS=$? cd $FINDPATH find -type d -mtime +30 -print > $BACKPATH/list.txt # FIND FILES THAT CREATED BEFORE 30 DAYS. FIRST=$(ls $BACKPATH/list.txt | grep... (5 Replies)
Discussion started by: leo_ultra_leo
5 Replies

10. Red Hat

RHEL 7: Backup Space and Delete is not working in console

Hi All, During my virtual machine power on i have rc3.d script to accept user inputs like IP address. This script gets executed during first time boot up. It was working fine till my VM is using RHEL6.5. Now we migrated to RHEL 7 environment. While accepting the user inputs in console, I... (4 Replies)
Discussion started by: kalpeer
4 Replies
All times are GMT -4. The time now is 04:29 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy