Questions tagged [shell-script]

A shell script is a script written for the shell, or command line interpreter, of an operating system.

It is often considered a simple domain-specific programming language. Typical operations performed by shell scripts include file manipulation, program execution, and printing text.

1446 questions
8
votes
2 answers

Loop thru tar file and run commands on each file

I have a process of extracting new code to my servers where the code is packaged in a tar file. Each file referenced in the tar is backed up to a specific directory. I'd like to automate this process by reading the tar and processing each file…
Ken J
  • 433
5
votes
2 answers

How to place the output of find in to an array

I am a newbie in Unix. I have a requirement in which I have to put the output of find statement in array because later in the script I have to use the output lines one by one. My find statement will retrieve me the location of directories based on…
Ankit
  • 61
5
votes
4 answers

How to use ls command with cd recursively

I have a requirement where I need to validate the nested folder structure. Ex: I have 3 folders: test1, test2, test3 (Practically there can be anynumber of such folders). Now all these folders should contain folder like V1, V2... like that ('V'…
Ankit
  • 51
5
votes
3 answers

verify ASCII file with file command by shell scrript

With the file command I need to verify many files if they ASCII or other format Sometimes I get from file command: file1: ASCII English text And sometimes I get different answer from file command file2: Non-ISO extended-ASCII English text,…
jennifer
  • 1,117
2
votes
1 answer

'action' command in shell scripting

Look at the following lines of code: . $IPKG_INSTROOT/etc/functions.sh initscript=$1 action=${2:-help} shift 2 What does the action command do?
Akshaa
  • 23
2
votes
1 answer

What does this script mean?

I'm trying to understand the following shell script: /usr/local/bin/uncrustify -q -c ~/objc.cfg -l oc But I don't know what some of the parts say. This part /usr/local/bin/uncrustify says go to the bin directory and run the program uncrustify with…
lampShade
  • 489
1
vote
1 answer

Unable to connect to Amazon EC2 without using PPK file

I have a build job which runs on Hudson and synchronizes content from an Amazon AWS server. This is written in shell I have a PPK file given to me which can establish the connectivity Here is the problem. The build script I use doesn't establish the…
Krishna
  • 19
1
vote
1 answer

Pop current directory until specific file is found

I'm interested in writing a script with the following behavior: See if a file, build.xml, exists in the current directory, if so run a command supplied through arguments to the script. If not, pop the current directory and look at the parent. Go to…
not34
  • 113
1
vote
1 answer

Copy all files to their parent folder

I need to move all the videos files in a file tree to their parent folders, for example: origin: A--sub1--file1 file2 sub2--file3 --file4 sub3--file5 B--sub1--file1 file2 sub2--file3 --file4 sub3--file5 …
zhanwu
  • 973
1
vote
1 answer

I have 2 versions of the same shell script. ASCII wise they are Identical, but only one executes correctly

I have 2 version of the same shell script file. ASCII wise they are Identical (Used Notepad++ Compare Plugin), but only one executes correctly. I ran FC /B on the windows command line to compare them at a binary level it it says they are different.…
1
vote
2 answers

Replace slashes in a url

I'd like to replace all slashes from a web address. Example address: https://example.com/sub/folder/files/file.txt Expected result: example.com-sub-folder-files-file.txt I can strip the https but I seem unable to replace the remaining slashes…
1
vote
1 answer

How filter FIND -E . REGEX using beginning and end of the file name?

I'm currently using this command to get a list of files : find -E . -regex '.*\.(jpg|jpeg|png|gif|pdf)' Using that command, I would get this list : Now : documentA.pdf documentB.jpeg 001documentC.png ... My aim is to filter this list, so I would…
Jean
  • 173
0
votes
1 answer

why i can't run binary from /home path

I have a binary "test", I try to run it as follows: root@g-6:~# ./home/test -bash: ./home/test: No such file or directory Have you an idea, please, about the error ? Thank you so much.
0
votes
1 answer

Retrival of read names from fastq file for a particular seq

I have a fastq file.The reads are of length 75bp. This is how a fastq file looks like @ERR030899.2391…
0
votes
2 answers

What is a non-standard option and why should they be avoided?

I see this all the time in manual pages, usually referring to --verbose flags. From the ln manual page: The -h, -i, -n and -v options are non-standard and their use in scripts is not recommended. What exactly does this mean? Specifically for this…
1
2