• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

The "Linux questions (and other stuff)" thread

Hint -

Code:
# Change input field separator from default space, restore when done

SAVEIFS=$IFS
IFS=$(echo -en "\n\b")

for SUBDIR in `ls -d1 */`
do
  echo "Testing: $SUBDIR"
done

# cleanup

IFS=$SAVEIFS
Kinda in a hurry, saw this on a drive-by, sorry it's not complete.

Probably use sed to fix whatever else within the for loop.
 
  • Like
Reactions: MoodyBlues
Upvote 0
I didn't know Mint was at the top.

Now I wonder if I should be proud that my OS of choice is the most popular or if maybe I should be bucking the trend and using something that isn't quite so mainstream.

I could go back to Slackware, try Arch, or something.

I see DSL is finally looking at an update after four years of no movement...

I always did like the early fluxbox interface of DSL.
 
Upvote 0
Not really unless I push it to the upcoming weekend as I have more important things to do between now and Friday
Okay, here's my script:

[high]
#!/bin/bash
SUBDIR=$1
SAVEIFS=$IFS

IFS=$(echo -en "\n\b")
cd $SUBDIR

for SUBDIR2 in `ls -d1 */`
do ZIPFILE=$(basename "$SUBDIR2")
zip -r $ZIPFILE/$ZIPFILE.zip $SUBDIR2
done

# cleanup
IFS=$SAVEIFS
[/high]

As always, this can be tweaked as needed/desired. Right now, it's taking you to the directory whose name you enter at runtime, then it's doing its thing as far as locating subdirectories and zipping their contents. It's creating the zipped files in each subdirectory; of course that can be changed to wherever you'd prefer.

And thanks to EM for the $IFS idea. :)
 
  • Like
Reactions: EarlyMon
Upvote 0
Okay, here's my script:

[high]
#!/bin/bash
SUBDIR=$1
SAVEIFS=$IFS

IFS=$(echo -en "\n\b")
cd $SUBDIR

for SUBDIR2 in `ls -d1 */`
do ZIPFILE=$(basename "$SUBDIR2")
zip -r $ZIPFILE/$ZIPFILE.zip $SUBDIR2
done

# cleanup
IFS=$SAVEIFS
[/high]

As always, this can be tweaked as needed/desired. Right now, it's taking you to the directory whose name you enter at runtime, then it's doing its thing as far as locating subdirectories and zipping their contents. It's creating the zipped files in each subdirectory; of course that can be changed to wherever you'd prefer.

And thanks to EM for the $IFS idea. :)

Don't have to pump those through sed to escape any blanks in the path name?

Apparently not. What Moody posted works :)
 
Upvote 0
What's the default desktop environment for Debian?
It used to be Gnome 2, but assume it may be Gnome 3. I haven't installed a default Debian in very long time.

I'm not running it at the moment but when I did, I would do a minimum install of the basic system and then add other components as I needed them. Such as a WM instead of DE.
 
  • Like
Reactions: Dngrsone
Upvote 0
What's the default desktop environment for Debian?

It used to be Gnome 2, but assume it may be Gnome 3.
What about Unity? Or is that strictly a *buntu thing? (I stick to my trusty and beloved KDE, so I'm quite out of the loop on those other DEs. :D)
 
Upvote 0
Unity is the default on Ubuntu (I wouldn't say strictly though as it can be installed on non-*buntu distros)

Unity is not exclusive to Ubuntu... one should be able to install it on Debian.
Thanks for the info. Now I guess the question is, WHY would anyone want to install it?! :laugh: (Yes, I'm a KDE person through and through--but I did try Unity (just for the hell of it) a few times, so at least I'm not insulting something I've never tried!)
 
Upvote 0
I don't get on well with bash (I dislike the syntax and there seems to me to be a number of "gotchas"). I guess if I had ambitions of being a system admin I'd have to change my ways but for me at home, I'd probably do something like.

PHP:
<?php
if (count ($argv) !=2){
  echo "Usage zip.php directory\n";
  exit;
}

if (!@chdir($argv[1])){
  echo "Invalid directory\n";
  exit;
}

$logfile = "zip.log";
@unlink($logfile);
foreach (glob("*", GLOB_ONLYDIR | GLOB_MARK) as $dir){
  $name = basename($dir);
  exec("zip -r \"$dir$name.zip\" \"$dir\" &>>$logfile");
}
?>
 
  • Like
Reactions: EarlyMon
Upvote 0
I don't get on well with bash (I dislike the syntax and there seems to me to be a number of "gotchas"). I guess if I had ambitions of being a system admin I'd have to change my ways but for me at home, I'd probably do something like.

PHP:
<?php
if (count ($argv) !=2){
  echo "Usage zip.php directory\n";
  exit;
}

if (!@chdir($argv[1])){
  echo "Invalid directory\n";
  exit;
}

$logfile = "zip.log";
@unlink($logfile);
foreach (glob("*", GLOB_ONLYDIR | GLOB_MARK) as $dir){
  $name = basename($dir);
  exec("zip -r \"$dir$name.zip\" \"$dir\" &>>$logfile");
}
?>

There are other shells...
 
Upvote 0

BEST TECH IN 2023

We've been tracking upcoming products and ranking the best tech since 2007. Thanks for trusting our opinion: we get rewarded through affiliate links that earn us a commission and we invite you to learn more about us.

Smartphones