03-10-2010
Deletes those files in a directory ?
I need a shell script that accepts 2 directories names
bar1 and bar2
as arguments , and deletes those files in
bar2 which are are identical to their name
spaces in
bar1.
I tried with this code but it gives error.
if [ $# -eq 1 ]
then
echo " syntax <comnd dir1 dir2 > "
exit
else
#echo $1 $2
for i in `ls $1`
do
for j in `ls $2`
do
if [ $i=$j ]
then
unlink $j
fi
done
done
fi
o/p :-
bash-3.1$ sh 17.sh
unlink: cannot unlink `bar1': Is a directory
unlink: cannot unlink `bar2': Is a directory
unlink: cannot unlink `bar1': Is a directory
unlink: cannot unlink `bar2': Is a directory
unlink: cannot unlink `bar1': Is a directory
unlink: cannot unlink `bar2': Is a directory
bash-3.1$
Thnak you
Krish
10 More Discussions You Might Find Interesting
1. UNIX for Dummies Questions & Answers
I would like to be able to delete the first n lines of a file from inside of a ksh script. I am not sure how to achieve this or if it is possible. Could someone please help. Thanks in advance. (5 Replies)
Discussion started by: rehoboth
5 Replies
2. Shell Programming and Scripting
Shell Program which deletes all lines containing the word "UNIX" in the files supplied as argument..please help me to do this task :) (4 Replies)
Discussion started by: abhiseknitd
4 Replies
3. UNIX for Advanced & Expert Users
Hi
I have a strange problem. Sometimes when I execute the below command something wierd happens.
rsync -avz -e ssh travegre@travegre.net: ../travegre.net/
the folder named "hm" that is held in travegre.net and is coppied along with all the other folders and data at travegre.net, gets... (1 Reply)
Discussion started by: travegre
1 Replies
4. UNIX for Advanced & Expert Users
Hi
I have a strange problem. Sometimes when I execute the below command something wierd happens.
rsync -avz -e ssh travegre@travegre.net: ../travegre.net/
the folder named "hm" that is held in travegre.net and is coppied along with all the other folders and data at travegre.net, gets deleted... (4 Replies)
Discussion started by: travegre
4 Replies
5. Shell Programming and Scripting
I want to write a script that deletes files inside the dir. However, the script
should also allow the user to confirm by pressing (d) key before deleting files..
#!/bin/bash
for file in $1/*
do
size='ls -l $file | cut -f 5 -d " "'
name='ls -l $file | cut -f 9 -d " "'
... (1 Reply)
Discussion started by: herberwz
1 Replies
6. UNIX for Advanced & Expert Users
I have a complex multi-stage (media conversion and formatting) build process that leaves orphan target files needing deleting automatically (i.e. by reference only to the build rules themselves, not any parallel config) upon each regular build. Since MAKE cannot do this, what can? Thanks. (4 Replies)
Discussion started by: chrisjj
4 Replies
7. Slackware
I am using Tbird as it came with Slackware 13.37 and everytime I send something I get a message 1 or 2 drafts deleted. Should it be doing that? If not has this been reported ? How can I find out if it was reported? I have no drafts to delete. (2 Replies)
Discussion started by: slak0
2 Replies
8. Solaris
i am trying to remove a directory using rm -rf command but its not getting removed.. it doesnt throw any error also.. i am logging as the owner of the dir and removing it but still no luck.. i am able remove a file but not a directory.
i am using solaris 10 (12 Replies)
Discussion started by: chidori
12 Replies
9. UNIX for Dummies Questions & Answers
Hi
It happens when I try to delete a file of 250MB with the command rm -r on our old Intergraph CLIX that the filename disappears while the blocks remain on the machine. Only when I reboot the system the blocks really disappear. Then rm works again for sometime but after some time it happens... (15 Replies)
Discussion started by: hausi2012
15 Replies
10. Shell Programming and Scripting
Given a directory containing say a few thousand files,
please output a list of all the names of the files in the directory that are exactly the same, i.e. have the same contents.
func(a_directory_name) output -> {“matches”: , ... ]}
e.g. func(“/home/my/files”) where the directory... (7 Replies)
Discussion started by: anuragpgtgerman
7 Replies
LEARN ABOUT SUSE
gtk2::radiobutton
Gtk2::RadioButton(3) User Contributed Perl Documentation Gtk2::RadioButton(3)
NAME
Gtk2::RadioButton
SYNOPSIS
# first group
$foo1 = Gtk2::RadioButton->new (undef, 'Foo One');
$foo2 = Gtk2::RadioButton->new ($foo1, 'Foo Two');
$foo3 = Gtk2::RadioButton->new ($foo2, 'Foo Three');
# second group, using the group reference
$bar1 = Gtk2::RadioButton->new (undef, 'Bar One');
$group = $bar1->get_group;
$bar2 = Gtk2::RadioButton->new ($group, 'Bar Two');
$bar3 = Gtk2::RadioButton->new ($group, 'Bar Three');
# move bar3 from the bar group to the foo group.
$bar->set_group ($foo->get_group);
# iterate over the widgets in the group
$group = $foo1->get_group;
foreach my $r (@$group) {
$r->set_sensitive ($whatever);
}
DESCRIPTION
A single radio button performs the same basic function as a Gtk2::CheckButton, as its position in the object hierarchy reflects. It is
only when multiple radio buttons are grouped together that they become a different user interface component in their own right.
Every radio button is a member of some group of radio buttons. When one is selected, all other radio buttons in the same group are
deselected. A Gtk2::RadioButton is one way of giving the user a choice from many options; Gtk2::OptionMenu and Gtk2::ComboBox (added in
gtk+ 2.4) are alternatives.
Each constructor can take either a group or widget from that group where the group is wanted; this is an enhancement over the C API.
Nevertheless, the _from_widget forms are provided for completeness.
HIERARCHY
Glib::Object
+----Glib::InitiallyUnowned
+----Gtk2::Object
+----Gtk2::Widget
+----Gtk2::Container
+----Gtk2::Bin
+----Gtk2::Button
+----Gtk2::ToggleButton
+----Gtk2::CheckButton
+----Gtk2::RadioButton
INTERFACES
Glib::Object::_Unregistered::AtkImplementorIface
Gtk2::Buildable
Glib::Object::_Unregistered::GtkActivatable
METHODS
widget = Gtk2::RadioButton->new ($member_or_listref=undef, $label=undef)
o $member_or_listref (scalar) reference to radiobutton group or a Gtk2::RadioButton belonging to that group.
o $label (string)
Create a radio button. If $label is provided, it will be interpreted as a mnemonic. If $member_or_listref is undef, the radio button will
be created in a new group.
widget = Gtk2::RadioButton->new_from_widget ($group, $label=undef)
o $group (Gtk2::RadioButton or undef)
o $label (string)
widget = Gtk2::RadioButton->new_with_label ($member_or_listref=undef, $label=undef)
o $member_or_listref (scalar) reference to radiobutton group or a Gtk2::RadioButton belonging to that group.
o $label (string)
Create a radio button with a plain text label, which will not be interpreted as a mnemonic.
widget = Gtk2::RadioButton->new_with_label_from_widget ($group, $label=undef)
o $group (Gtk2::RadioButton or undef)
o $label (string)
widget = Gtk2::RadioButton->new_with_mnemonic ($member_or_listref=undef, $label=undef)
o $member_or_listref (scalar) reference to radiobutton group or a Gtk2::RadioButton belonging to that group.
o $label (string)
Create a radio button with a mnemonic; this is an alias for "new".
widget = Gtk2::RadioButton->new_with_mnemonic_from_widget ($group, $label=undef)
o $group (Gtk2::RadioButton or undef)
o $label (string)
$group = $radio_button->get_group
Return a reference to the radio group to which $radio_button belongs. The group is a reference to an array of widget references; the array
is not magical, that is, it will not be updated automatically if the group changes; call "get_group" each time you want to use the group.
$radio_button->set_group ($member_or_listref)
o $member_or_listref (scalar) reference to the group or a Gtk2::RadioButton belonging to that group.
Assign $radio_button to a new group.
PROPERTIES
'group' (Gtk2::RadioButton : writable / private)
The radio button whose group this widget belongs to.
SIGNALS
group-changed (Gtk2::RadioButton)
SEE ALSO
Gtk2, Glib::Object, Glib::InitiallyUnowned, Gtk2::Object, Gtk2::Widget, Gtk2::Container, Gtk2::Bin, Gtk2::Button, Gtk2::ToggleButton,
Gtk2::CheckButton
COPYRIGHT
Copyright (C) 2003-2008 by the gtk2-perl team.
This software is licensed under the LGPL. See Gtk2 for a full notice.
perl v5.12.1 2010-07-05 Gtk2::RadioButton(3)