Sponsored Content
Top Forums UNIX for Beginners Questions & Answers Command finds some, misses some Post 303033329 by Xubuntu56 on Wednesday 3rd of April 2019 09:42:40 AM
Old 04-03-2019
Command finds some, misses some

The contents of my home directory:


bin Desktop Documents Downloads folders Music Pictures Public Templates Videos

When I run the command
Code:
for file in /home/myself/*d*; do if [ -x "$file" ]; then echo $file; fi; done

it finds
Code:
 /home/myself/Downloads 
 /home/myself/Videos

but not "folders".




Ubuntu 18.04.2; Xfce 4.12.3; kernel 4.15.0-45-generic; bash 4.4.19(1); Dell Inspiron-518
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

PS finds a ghost?

Hello, I have problems executing a script in ksh with this script named process.sh: ps -ef | grep process.sh | grep -v grep | wc -l | read a if then echo "The script is running" exit 0 fiThe problem is that when I execute the script, sometimes it shows the message "The script is... (10 Replies)
Discussion started by: jguirao
10 Replies

2. News, Links, Events and Announcements

SETI Finds Stolen Laptop

The SETI@home project invites volunteers to install special software of their home computers. This software, called BOINC, runs computational jobs when the computer would otherwise be idle. And the software needs to contact the main server periodically to deliver results and obtain new problems.... (2 Replies)
Discussion started by: Perderabo
2 Replies

3. Shell Programming and Scripting

Read from text file misses first line

Hi! I need to read in the first line from a text file (which will only ever have one line in it), so I tried this.... while read line do echo $line done < $file But this wasn't returning anything. So I tired a different file, which had multiple lines of text in it, and it returned... (2 Replies)
Discussion started by: davewg
2 Replies

4. UNIX for Dummies Questions & Answers

very urgent..need of a script which finds a file without the use of find command..hlp

im a beginner in shell scripting and i need a script which will find a file in a given path without the use of find or grep command.......i need some kind of code.....plzzz plzzzz help me......ive tried n searched every where but i couldn't find the solution for my particular problem..... (4 Replies)
Discussion started by: mishi
4 Replies

5. Shell Programming and Scripting

Sometimes my until loop misses it's target

Hello all, I wrote a quick function (alarm) in my bash_profile (in cygwin) for practice. It uses until loops to wait for a specified time, and once that time passes triggers a play on a mp3. Most of the time it works, however sometimes it seems like it's looping through too slowly and will miss... (1 Reply)
Discussion started by: DeCoTwc
1 Replies

6. Shell Programming and Scripting

combine multiple finds into 1-liner

How to combine 3 find statements into 1-liner? find statements: cd ${dir1} ; find . ! -name . -prune -type f | xargs file | grep -i ascii | cut -f1 -d: | xargs grep -l "${searchtxt}" cd ${dir2} ; find . ! -name . -prune -type f | xargs file | grep -i ascii | cut -f1 -d: | xargs grep -l... (4 Replies)
Discussion started by: ux4me
4 Replies

7. UNIX for Dummies Questions & Answers

find -size -7M finds files, but won't cp them all

If I run: find /somefolder -type f -size -7M | wc -l I get 73594 files But when I run find /somefolder -type f -size -7M -exec /bin/cp -v {} /someotherfolder/ \; it only copies 38891 of the files to the folder, why? There's a mix of all types of files in /somefolder. Is there some other... (12 Replies)
Discussion started by: unclecameron
12 Replies

8. Shell Programming and Scripting

sed finds nothing but it changes file's timestamp

I must go through some files to change a certain string within text files to another string. I use openSUSE and folders are mounted by cifs. Text to be replaced (only in .m extension) is U:\FOLDER and new string is N: That works fine with spaces in directory names etc., but this process ... (5 Replies)
Discussion started by: Pappa41
5 Replies

9. Shell Programming and Scripting

I want my script to NOT to send an e-mail if it finds the same keyword more than twice.

My script triggers and e-mail if keywords supplied to it were found. Problem is if it find the same keyword continously (due to continous server errors), it triggers mails and fillup my mail box with same message (which is not required) I want my script to NOT to send an e-mail if it finds the... (13 Replies)
Discussion started by: Rajeshneemkar
13 Replies

10. Shell Programming and Scripting

Finds all duplicate files

Hi, How would you write bash script that given a directory as an argument and finds all duplicate files (with same contents - by using bytewise comparison) there and prints their names? (6 Replies)
Discussion started by: elior
6 Replies
xdg-user-dirs-update(1) 					   User Commands					   xdg-user-dirs-update(1)

NAME
xdg-user-dirs-update - Create and configure default desktop user directories. SYNOPSIS
xdg-user-dirs-update [--force] [--dummy-output path] [--set DIR path] DESCRIPTION
xdg-user-dirs-update is used to create the default desktop user directories such as : Desktop Download Templates Public Documents Music Pictures Videos In general this is run at user login to an XDG compatible desktop such as GNOME or KDE. The directories are created using the user's locale - and this information is then stored in the ${HOME}/.config/user-dirs.dirs file such that if the user then changes the locale they log in as, the directories will still be referenced correctly, but will remain in the original locale unless you run the xdg-user-dirs-update com- mand with the --force option. The default names used to create these directories are configured in the system configuration file /etc/xdg/user-dirs.defaults. Other configuration is stored in the file /etc/xdg/user-dirs.conf. In this file you can disable this functionality system-wide and define what encoding is used in the creation of the directories. By default this is UTF-8 since this is the main encoding used in the desktops. Continuous monitoring is done by the file manager - nautilus in GNOME - and if these directories are renamed or removed nautilus will update the user's configuration file to reflect this change. OPTIONS
--force Force an update of the directories to the current locale. --dummy-output path Simulate the creation of the user configuration file and write to the specified path. --set DIR path Update the user's configuration changing the DIR to point to the specified path. Valid desktop directories (DIR) are: DESKTOP DOWNLOAD TEMPLATES PUBLICSHARE DOCUMENTS MUSIC PICTURES VIDEOS FILES
The following files are used by this application: /usr/bin/xdg-user-dirs-update XDG User Directory management utility. /etc/xdg/user-dirs.conf Used to configure the operation of xdg-user-dirs-update. Can be used to totally disable the the creation of these directories and also to define what locale encoding should be used by default - by default this is UTF-8 which is the preferred encoding used by the GNOME Virtual File System layer. /etc/xdg/user-dirs.defaults Used to configure the default locations that xdg-user-dirs-update will create/manage relative to the user's ${HOME}. ${HOME}/.config/user-dirs.dirs Location of the user-specific configuration including the current list of directories and what they map to. ${HOME}/.config/user-dirs.locale Contains the name of the locale (excluding encoding) that was used to create the initial set of directories. EXAMPLES
Example 1: Determine what may happen if you force an update. % xdg-user-dirs-update --force --dummy-output /tmp/dummy.out Moving DOWNLOAD directory from Downloads to Download Also will write output like the following to /tmp/dummy.out: # This file is written by xdg-user-dirs-update # If you want to change or add directories, just edit the line you're # interested in. All local changes will be retained on the next run # Format is XDG_xxx_DIR="$HOME/yyy", where yyy is a shell-escaped # homedir-relative path, or XDG_xxx_DIR="/yyy", where /yyy is an # absolute path. No other format is supported. # XDG_DESKTOP_DIR="$HOME/Desktop" XDG_DOWNLOAD_DIR="$HOME/Download" XDG_TEMPLATES_DIR="$HOME/Templates" XDG_PUBLICSHARE_DIR="$HOME/Public" XDG_DOCUMENTS_DIR="$HOME/Documents" XDG_MUSIC_DIR="$HOME/Music" XDG_PICTURES_DIR="$HOME/Pictures" XDG_VIDEOS_DIR="$HOME/Videos" Example 2: Change location of my pictures. % xdg-user-dirs-update --set PICTURES /home/user/Documents/MyPictures Modifies the ${HOME}/.config/user-dirs.dirs file to have the line: ... XDG_PICTURES_DIR="$HOME/Documents/MyPictures" ... ATTRIBUTES
See attributes(5) for descriptions of the following attributes: +-----------------------------+-----------------------------+ | ATTRIBUTE TYPE | ATTRIBUTE VALUE | +-----------------------------+-----------------------------+ |Availability |SUNWxdg-user-dirs | +-----------------------------+-----------------------------+ |Interface stability |Uncommitted | +-----------------------------+-----------------------------+ SEE ALSO
More information can be found at: http://www.freedesktop.org/wiki/Software/xdg-user-dirs xdg-user-dirs-gtk-update(1), xdg-user-dir(1), attributes(5) NOTES
Written by Darren Kenny, Sun Microsystems Inc, 2008 SunOS 5.11 03 Apr 2008 xdg-user-dirs-update(1)
All times are GMT -4. The time now is 06:55 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy