Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8734089
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T09:46:27+00:00 2026-06-13T09:46:27+00:00

I have this script: echo -e >> Please, insert edition folder name: ; read

  • 0

I have this script:

    echo -e ">> Please, insert edition folder name: ";
    read editionfolder;
    RSeditionfolder="$editionfolder";    
    sh -c $POSTGRESbin'psql -U '$POSTGRESuser' -h localhost -d '$POSTGRESdb' -c "select count(*) from d3_folders where folder_name = '\'$RSeditionfolder\'';"' > $queryFolder$tmpFile

For example, if I insert in editionfolder var: CD_199 FOTOS I receive an error:

FOTOS';": -c: line 0: unexpected EOF while looking for matching `"'
FOTOS';": -c: line 1: syntax error: unexpected end of file

$queryFolder has “query/” value and $tmpFile has “tmpfile”

But I don’t know what I’m doing wrong.

The result of this query is:

 count 
-------
     0
(1 row)

I only want the number 0, in this case. I’m triying to put the result in a file and the next step is use sed in this file, I you know other way I would be very grateful to know it.

Thanks !!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T09:46:28+00:00Added an answer on June 13, 2026 at 9:46 am

    The given command is a little messy, I would write that like

    sh -c "${POSTGRESbin}psql -U $POSTGRESuser -h localhost -d $POSTGRESdb -c \"select count(*) from d3_folders where folder_name = '$RSeditionfolder';\"" > ${queryFolder}${tmpFile}
    

    First of all, I would get rid of all those single quotes using $-variables inside the double quotes. Second, it would be good to clarify clause ’$queryFolder$tmpFile’ using explicit variable name borders, ${queryFolder}${tmpFile}. But in general the script is fine.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a line of php code that looks like this: echo <script>$('#edit_errors').html('<h3><em>Please Correct
For testing purposes I have this shell script #!/bin/bash echo $$ find / >/dev/null
I have this code: <div id=gll_select> <script> var caffe = $(#caffe).val(); $(#gll_select).load(<?php echo base_url()
I have a batch script that looks like this: Test.bat @echo off :: Starts
I have a script that looks like this #!/bin/bash function something() { echo hello
I have PHP scrip that goes like this: if ($cost_frm < $cost){ echo <script
I have this script that run to fix my menu bar to the browser
I have this script and need to be able to call the $play variable
I have this script set up that echoes all relevant users in a database
I have this script in the head of my index.html. I want different scripts

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.