Sponsored Content
Full Discussion: Symlink creation
Top Forums Shell Programming and Scripting Symlink creation Post 302976037 by Don Cragun on Wednesday 22nd of June 2016 08:56:46 PM
Old 06-22-2016
It looks like bakunin was missing a double quote (shown in red on the 2nd line in the script below), but a space between the test argument and the closing square bracket is crucial. Try:
Code:
ls | while read FILE ; do
     if [ -f "$FILE" ] ; then     # only process files (i.e. not subduers)
          command1 "$FILE"
          command2 "$FILE"
     fi
     [....]
done

 

9 More Discussions You Might Find Interesting

1. Linux

Problem in sharing Symlink via NFS

Hi, I have created symlink under /. It is /latest Pointing to /home/users/neel_prog_V1.0. (Note: I have created this symlink so that when version get changed I will need to change only symlink instead of doing changes in /etc/exports.) I have shared this symlink with NFS. in /etc/exports I... (0 Replies)
Discussion started by: neel.gurjar
0 Replies

2. UNIX for Dummies Questions & Answers

creating symlink

hi... I have a folder<abc> under /root folder. I want to create a symlink such that when i click on folder<abc> under root, should display my home folder (home/krish). Immediate inputs appreciated..... (1 Reply)
Discussion started by: rama.honge
1 Replies

3. Shell Programming and Scripting

sed -i destroy symlink - how to solve this ?

After a few hours of frustration because I didn't understand why my symlinks are destroyed i just found out that sed -i will destroy symlinks. I searched but i didn't found any good solution for this. Is there any way to overcome this ? On my ubuntu server sed version is 4.1.5 edit: Sorry... (0 Replies)
Discussion started by: ktm
0 Replies

4. Solaris

symlink on link file

Hi all, I want to create a symlink on a link file, i mean, there is a file which is actually a symlink of some version. Now i want to create one more symlink on that link file. EX: there is a file: uat -> version prod -> version Now i want to create one more link on these 'uat' and... (1 Reply)
Discussion started by: raghu.iv85
1 Replies

5. Shell Programming and Scripting

ln -s creates symlink in symlink, if [ -f ... ] says file that exists doesn't exist

Hi Forums, I got a little problem, I made a few modifications to the code of the launch script of a testing server(minecraft) and now updating is broken aswell as the automatic directory creation. These Lines somehow create an endless symlink that refers to itself and I don't know how to fix... (0 Replies)
Discussion started by: Xaymar
0 Replies

6. UNIX for Dummies Questions & Answers

Advanced Symlink Creation script

Hello. I am working on creating a script to recursively run on my media collection. The goal is to recreate the folder structure, but with slight changes in the folder names based on my rules. The folders will also include the .jpg & .mkv files, renamed according to a similar set of rules. ... (4 Replies)
Discussion started by: Davinator
4 Replies

7. Ubuntu

Creating conditional symlink

Hi All, Is there any way to create a symlink that will point to last 1000 line of a log file. My symlink will always point to "tail -1000 logfile". This can be achieved by writing a script and scheduling with high frequency, but I am looking for some other alternatives. Please let me know... (8 Replies)
Discussion started by: sussus2326
8 Replies

8. UNIX for Dummies Questions & Answers

Remove symlink and target

i would like to remove a directory and also symlink target inside. my_directory -- file1 -> /targetpath/file1 -- file2 -> /targetpath/file2 rm -rf my_directory will not remove symlink target. rm -rf "`readlink -f file1`" will only remove target if specifying the symlink is specified ... (4 Replies)
Discussion started by: lsy
4 Replies

9. UNIX for Beginners Questions & Answers

Symlink

I know how to create a symlink but I am getting an error message that the file already exists. Also, my symlink doesn't point from target directory to the path correctly, Here is an example of the path to my folder structure path: cd /wkspce/wff/DEV/jobs/DEL the folder structure is: ... (3 Replies)
Discussion started by: dellanicholson
3 Replies
UNLOCKED_STDIO(3)					     Linux Programmer's Manual						 UNLOCKED_STDIO(3)

NAME
*_unlocked - non-locking stdio functions SYNOPSIS
#include <stdio.h> int getc_unlocked(FILE *stream); int getchar_unlocked(void); int putc_unlocked(int c, FILE *stream); int putchar_unlocked(int c); #define _BSD_SOURCE /* or _SVID_SOURCE or _GNU_SOURCE */ #include <stdio.h> void clearerr_unlocked(FILE *stream); int feof_unlocked(FILE *stream); int ferror_unlocked(FILE *stream); int fileno_unlocked(FILE *stream); int fflush_unlocked(FILE *stream); int fgetc_unlocked(FILE *stream); int fputc_unlocked(int c, FILE *stream); size_t fread_unlocked(void *ptr, size_t size, size_t n, FILE *stream); size_t fwrite_unlocked(const void *ptr, size_t size, size_t n, FILE *stream); #define _GNU_SOURCE #include <stdio.h> char *fgets_unlocked(char *s, int n, FILE *stream); int fputs_unlocked(const char *s, FILE *stream); #define _GNU_SOURCE #include <wchar.h> wint_t getwc_unlocked(FILE *stream); wint_t getwchar_unlocked(void); wint_t fgetwc_unlocked(FILE *stream); wint_t fputwc_unlocked(wchar_t wc, FILE *stream); wint_t putwc_unlocked(wchar_t wc, FILE *stream); wint_t putwchar_unlocked(wchar_t wc); wchar_t *fgetws_unlocked(wchar_t *ws, int n, FILE *stream); int fputws_unlocked(const wchar_t *ws, FILE *stream); DESCRIPTION
Each of these functions has the same behaviour as its counterpart without the `_unlocked' suffix, except that they do not use locking (they do not set locks themselves, and do not test for the presence of locks set by others) and hence are thread-unsafe. See flockfile(3). CONFORMING TO
The four functions getc_unlocked(), getchar_unlocked(), putc_unlocked(), putchar_unlocked() are in POSIX.1. The nonstandard *_unlocked() variants occur on a few Unix systems, and are available in recent glibc. They should probably not be used. SEE ALSO
flockfile(3) 2001-10-18 UNLOCKED_STDIO(3)
All times are GMT -4. The time now is 10:26 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy