(Bash) How to set a variable with text from a file? [SOLVED]

I'm having a little problem.
I have textfile with a single line of text. What I want to do is set a variable with that line of text. How do I go about doing that?
A simple var="text" wont work in this case, since the text in the file changes with another script of mine.
Thanks in advance.
Last edited by Aziere (2007-03-27 09:07:03)

if you have a file with more than one line but you only want the first line you could use 'head'
VAR=`head -n 1 file`
Last edited by SiD (2007-03-27 05:58:33)

Similar Messages

  • How to Set a Variable with data from Srouce Data Store

    Hello ODI Experts,
    I have created a Physical & Logical Schema and a Source Data store to pickup data from a database table.
    On the other hand, I have a few variable that I will pass in a web service call (ODIInvokeWebService tool).
    Would yo please guide how I can set variables from my source data store.
    Thanks & Regards,
    Ahsan

    Hello Bos/Damodhar/ODI Experts,
    Doesn't it gives me a less optimized approach picking one column per query (per variable)?
    Lets say, I have to pick 35 columns from a table and put those in 35 variables...It would mean running 35 queries for fetching one record from the database table.
    Doesn't it seem less performance effective (less optimized)..a little scary..any thing better that I can do to make it more optimized?
    Another question, what if multiple new values have come in the DB table, since I am using Refresh Variable, would this variable have multiple values in it?
    Thanks for all your help,
    Ahsan
    Edited by: Ahsan Asghar on 21-Jun-2011 07:46

  • How to set a variable's value from job output

    Can anyone point me at documentation on how to set the value of a variable based on the output of a job? We are running TES v6.0.2.153.
    The Agent/Adapter is a Linux command line, so the Command could be for example:
    echo foo
    and I would like a variable named bar to contain the value foo.  (Obviously in real life the variable value would be dependent on what the command output)
    Thanks in advance,
    Martin

    One more nugget: to parse the response from a command from a UNIX/Linux agent for a specific string and store that in a variable, I followed Rami's advice and then had to find the string in the output.
    The below example puts the first digit of a random number in the variable:
    Job Command:
    bash -c
    Command Parameters:
    "'echo' Random number is $RANDOM | perl -ple 's/.*Random number is (\d{1}).*/\1/'"
    Note that your command itself (in this case "echo") cannot be put in the Command box, otherwise TES does not interpret the Command Parameters correctly.  So you need to set the Command to "bash -c" (run the command in the parameter string), and enter your command and parameters within double quotes in the Command Parameters, with the command being run (in this case "echo") in single quotes at the beginning.
    (I also had to make my .bash_profile run without any output to avoid it being prefixed to the variable value.)
    Hope this helps,
    Martin.

  • Set/get variables with RSBBS from  query 1 to query 2

    Hi BW Experts,
    I created a sender/receiver assignment from query 1 to query 2 using RSBBS. For two characteristics I assigned the processing method by “Variable”. Process mode for these variables in the receiver query is by “customer exit”. But I don’t know how to set/get values of these variables.
    Is there any function module to do it ??
    Please help!!
    Dev

    thanks...but i m not used in RSBBS and i m afraid i m lost
    could anyone explain me in detail :
    - what i have to do for setting the sender & receiver,
    - before to set parameter ID in the sender how to get the information of the current line (which will serve for the jump)
    please help! i promise points
    Dev

  • How to set environment variables permanetly?

    I have installed oracle apps R12 on Oracle Enterprise Linux 5.3 successfully. When i run the file APPS<context_name>.env as oracle user(the one who installed software), the variables are set,,,but when i logout and login again,,,,,i dont see $ORACLE_HOME, $APPL_TOP etc......so please can someone tell me how to set the variables permanently..
    thanks

    Hi,
    set the env file in profile of unix user.
    if your shell is bash shell, then edit the user .bash_profile with env file. If your's is bourn shell, edit the user .profile
    for example,
    i have PROD as the database SID
    /oraprod and /applprod are the base mount points of database and application tiers respectively.
    erpserver is the hostname of R12 (single node)
    (1) Database Tier:
    login as oracle user
    $vi .bash_profile
    . /oraprod/db/tech_st/10.2.0/PROD_erpserver.env
    save the file
    (2) Application Tier:
    login as applmgr user
    $vi .bash_profile
    . /applprod/apps/apps_st/appl/APPSPROD_erpserver.env
    save the file
    ------

  • How to set environment variable ORACLE_HOME ?

    Hi
    I trying to install SAP Solution manager 4.0 SR3:
    OS: Linux RHEL4u4
    DB: Oracle
    SAPinst now stops the installation.
    To proceed with the installation, install the Oracle database as follows:
    1.Log in as user orassm.
    2.Set the DISPLAY variable.
    3.Change to directory /oracle/stage/102_32/database/SAP.
    4.Start './RUNINSTALLER'.
    After you installed the Oracle database software, proceed with the database instance
    installation by choosing 'OK' in this dialog box.
    ./RUNINSTALLER
    oracle_stage is not set (OK)
    oracle_base is not set (OK)
    oracle_home is not set (OK)
    oracle_sid is not set (OK)
    oracle_home_name is not set (OK)
    oracle_inst_group is not set (OK)
    from_location is not set (OK)
    tmp_netca_file is not set (OK)
    tmp_dbca_file is not set (OK)
    Working in /oracle/stage/102_32/database/SAP ...
    The environment variable ORACLE_HOME is not set! abort ...
    How to set environment variable ORACLE_HOME ?
    Regards
    Eric

    i
    Switch shell to bash:
    orassm:x:502:503:SAP Database Administrator:/oracle/SSM:/bin/bash
    [root@csp-p-sm00 ~]# su - orassm
    [orassm@csp-p-sm00 ~]$
    But when try to run ./RUNINSTALL
    [orassm@csp-p-sm00 SAP]$ ./RUNINSTALLER
    oracle_stage is not set (OK)
    oracle_base is not set (OK)
    oracle_home is not set (OK)
    oracle_sid is not set (OK)
    oracle_home_name is not set (OK)
    oracle_inst_group is not set (OK)
    from_location is not set (OK)
    tmp_netca_file is not set (OK)
    tmp_dbca_file is not set (OK)
    Working in /oracle/stage/102_32/database/SAP ...
    The environment variable ORACLE_HOME is not set! abort ...
    Additionaly I've post csh.cshrc and csh.login
    /etc/cshrc
    csh configuration for all shell invocations.
    by default, we want this to get set.
    Even for non-interactive, non-login shells.
    [ "`id -gn`" = "`id -un`" -a `id -u` -gt 99 ]
    if $status then
            umask 022
    else
            umask 002
    endif
    if ($?prompt) then
      if ($?tcsh) then
        set prompt='[%n@%m %c]$ '
      else
        set prompt=\[`id -nu`@`hostname -s`\]\$\
      endif
    endif
    if ( $?tcsh ) then
            bindkey "^[[3~" delete-char
    endif
    setenv MAIL "/var/spool/mail/$USER"
    limit coredumpsize 0
    if ( -d /etc/profile.d ) then
            set nonomatch
            foreach i ( /etc/profile.d/*.csh )
                    if ( -r $i ) then
                            source $i
                    endif
            end
            unset i nonomatch
    endif
    /etc/csh.login
    System wide environment and startup programs, for login setup
    if ($?PATH) then
            if ( "$" !~ /usr/X11R6/bin ) then
                    setenv PATH "$:/usr/X11R6/bin"
            endif
    else
            if ( $uid == 0 ) then
                    setenv PATH "/sbin:/usr/sbin:/usr/local/sbin:/bin:/usr/bin:/usr/local/bin:/usr/X11R6/bin"
            else
                    setenv PATH "/bin:/usr/bin:/usr/local/bin:/usr/X11R6/bin"
            endif
    endif
    setenv HOSTNAME `/bin/hostname`
    set history=1000
    if ( ! -f $HOME/.inputrc ) then
            setenv INPUTRC /etc/inputrc
    endif
    Regards
    Eric

  • How to set enviroment variables for Inso Filter

    Hi everyone,
    I want to convert word documents to html using CTX_DOC.Filter.According to the documentation,I know I neednot set the 'Inso Filter'in the preference when creating index,but I must set enviroment variables for Inso Filter.
    I found the following instructions for it in the 8.1.5 documentation,but I can't understand it well.Is there anyone can tell me how to set enviroments variables for Inso Filter on Windows2000 Server?(My DB version is 8.1.7EE)
    Environment Variable Locations
    All environment variables related to Inso filtering must made visible to interMedia Text. Set these variables in the following locations:
    listener.ora file. This makes the environment variables visible to the extproc PL/SQL process.
    The operating system shell from where ctxsrv server is started. This makes the environment variables visible to the ctxsrv process, which does background DML.
    Any suggestions are apreciated
    Reemon
    null

    NSAPI plugins are normally configured using parameters specified in magnus.conf and/or obj.conf. What plugin requires you set an environment variable?

  • How to set bind variable for a VO ,

    Hi,
    i got a requirement in which i have to set bind variable for VO , But the Bind variable is coming from payload attribute,
    For example my query in VO is select * from Employee where emp_id="payload attribute"
    How to set this attribute value is from the payload
    Thanks Regard
    Rajendar

    Hi i am getting this exception " Cannot create an object of type:java.lang.Number from type:oracle.bpel.services.datacontrol.data.DataObject with value:21159"
    Actually i am getting Decimal Value from Payload of BPEl process and i am trying to set this to The bind variable
    is that a type cast exception where can i typeCast Those values You should this in a new thread.Dont ask questions out of the scope of this thread.
    Please mark this thread as answered or helpful if you got solution for this thread.
    Thanks!!!

  • How to set task description with paragraphs at runtime

    Hi Experts, How to set task description with paragraphs at runtime. Now, i can set single content in task description.however, not sure, how to set content which have paragraphs.

    Hi,
    You can use HTML tags in the Task descritption.
    Open the task not the workflow and there you can provide
    <p> content/containers </>
    You can use even <u>- Underlined text.
    <h> for bold text
    Thanks,
    Sarayoodharan.K

  • I want to set a variable with default value and can be changed by the user

    hi,
    i want to set a variable with default value and can be changed by the user, so i new a variable with setting : customer exit, single value, optional, ready for input.
    in my customer exit code, i set a default value, eg. 20070530
    when the variable screen popup, it display the default value 20070530, i changed it to 20070529, but it doesn't work , it still display the data in 20070530, how can i solve this problem? 
    your help is appreciated.

    Liu,
       As mentioned by Anil, you need to restrict your customerr Exit code to I_STEP = 1.
    or.
       <u>Open your Variable in change mode, in the Last Page os the Variable Maintenance you can provide default value. Note: you are doing same thing in Customer Exit. In your case no need of Customer Exit.</u>
    Nagesh Ganisetti.
    Assign points if it helps.

  • How to set environment variables in WL ?

    Hi,
    How to set environment variables in WL ?
    Thanks,
    Srivi

    Hi,
    You can set the environmet variable in Weblogic by using the below commands
    setWLSEnv.cmd/sh ==>Set the CLASSPATH to include the WebLogic Server classes.
    Overview of WebLogic Server Domains
    or you can use to set the Environment variable along with domain specific varables using the SetDomainEnv.cmd
    To run SetDomainEnv.sh in Linux please use
    . ./setDomainEnv.sh it require two dots (Dont miss it )
    http://docs.oracle.com/cd/E28280_01/web.1111/e13749/weblogicserver.htm#ADMRF205
    Hope it helps

  • Crystal Report with text(csv) data file, can we set it as input parameter?

    Hi,
    I am a new user of Crystal Reports 2008.
    I have created a report with charts in it. The input data comes from a csv text file.
    Can I set the name of this text file as an input parameter?
    as I need to generate 44 similar reports with different text filenames(and data)?
    Thank you.
    Regards

    Brian,
    Thanks much.
    I did exactly what you said.
    Just to see any change, I first gave a bad report file name just to see if I am accidentally pointing to a different file,
    but I got an error saying report not found.
    Then I renamed my original datafile name and generated a report and it still generated one without giving an error.
    Then I also gave a junk name to the logoninfo and printed that name, the new name was assigned to logoninfo, but the code did not error out.
    It ended up generating the report.
    Now here is what I think is happening,
    1) The save data in report option seems to be still on even though I have turned it off in 2 locations
    a) file -> Report Options
    b) file -> Options -> Reporting tab.
    2) For some reason the logoninfo is getting ignored as well.
    Since I did not see any answers yesterday I posted a link to this thread on the .Net forum
    Crystal Report with text(csv) data file, can we set it as input param? C#
    and Ludek Uher says that I am connecting to the text file via a DAO database engine and so need to use the same code for changing the text file as for changing an Access database.
    But the link he gave me tells me to try the same thing that we have been trying..
    Here is my plan,
    1) I will first try and find out why my save data with report option is still on ( but it shows off in Crystal ).
    2) why is LogonInfo getting ignored.
    Meanwhile any suggestions from anyone are welcome.

  • Crystal Report with text(csv) data file, can we set it as input param? C#

    Hi,
    I am new to the forums and posted a question which belonged to the .net - SAP Crystal reports group.
    Can someone help me with my problem? following is the thread that I have started.
    Crystal Report with text(csv) data file, can we set it as input parameter?
    Thank you in advance.

    Looking at the original thread, you are connecting to the text file via the DAO database engine:
    "I added the text file as follow, new connection -> Access/Excell (DAO) -> select the file and the database type as text"
    Thus I would use the same code for changing the text file as for changing an Access database. See Kbase [1218178 - Error: "Logon failed" when connecting to Access database in .NET application|http://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/oss_notes_boj/sdn_oss_boj_bi/sap(bD1lbiZjPTAwMQ==)/bc/bsp/spn/scn_bosap/notes%7B6163636573733d36393736354636443646363436353344333933393338323636393736354637333631373036453646373436353733354636453735364436323635373233443330333033303331333233313338333133373338%7D.do] for more information. If that does not work, you may want to consider connecting via ODBC or feeding the data from the text file to and ADO .NET dataset and pointing the report at the dataset.
    Ludek
    Follow us on Twitter http://twitter.com/SAPCRNetSup
    Got Enhancement ideas? Try the [SAP Idea Place|https://ideas.sap.com/community/products_and_solutions/crystalreports]

  • How to set a variable value on the BPC Data Manager

    Hello BPC Experts,
    I'm creating a BPC10 NW version demo environment for our prospect customer.
    I made a data manager to import  BW data into BPC model from BW cube.
    I need to import just one month data into BPC from the BW cube that has more than one month data.
    When I run the data package manually, I can select a member of the time dimension prompt and I can import specific month data I want.
    But, in a case where the program (data manager) runs by JOB monthly,
    I can't select a member of the time dimension prompt manually.
    So I want to know how to set a  variable value to the time dimension prompt from a system date etc. automatically.
    Are there any way to set a variable value to the time dimension prompt on the data manager automatically from a system date?
    Or, do you have any other solution to import just one month data into BPC from the BW cube that has more than one month data  by the data manager running on JOB ?
    (without selecting a member of the time dimension prompt of the data package manually)
    Thanks in advance,
    Keisuke

    Hi Gersh
    Sorry for my late reply and thanks for your helpful information.
    I tried the second way of your information and I could configure it.  
    And I 'll try first way of your information.
    Regards,
    Keisuke

  • How to set up SAPconnect with email server

    Hi,
    Does any one know <b>how to set up SAPconnect with email server</b>
    We are using workflow and when it fails it we are sending the notification mail to the user on his company mail id, i.e. [email protected]
    This is working in the current production system. We are doing the new development which will replace the current production system. The existing Basis team does not know how it was setup in production system and how to set it up in the new system.
    When we send any mail notification from workflow we can see the mail in SCOT transaction but it is not received at the specified mail address.
    Can any one provide the configuration steps or any document for this.
    Thanks in advance..
    Pratik

    Hi Pratik,
    Check the following link:-
    /people/thomas.jung3/blog/2004/09/08/sending-e-mail-from-abap--version-610-and-higher--bcs-interface
    http://help.sap.com/saphelp_nw04/helpdata/en/2b/d925bf4b8a11d1894c0000e8323c4f/frameset.htm
    these link will help u to config SMTP.
    And one more thing u have to do..
    Go to SE11 n open Table sxnodes in change mode.
    And change F_ESMTP field to false i.e. BLANK for the Field NODE = SMTP.
    Hope this will work For U.
    Regards
    Sachin Dhingra

Maybe you are looking for

  • Computer shuts down while downloading Itunes

    Every time I start to download the new version of Itunes it shuts down my computer. No blue screen or error messages, and my computer starts back up just fine. It also freezes on the last step while syncing my Iphone. I've uninstalled and reinstalled

  • Custom icon for desktop shortcut

    Hi All, I have a link in the portal which when the end users click should create a desktop shortcut to the portal. I used this to create the desktop shortcut var WshShell = new ActiveXObject("WScript.Shell"); strDesktop = WshShell.SpecialFolders("Des

  • New Aluminum Keyboard

    Received new iMac keyboard today, hooked it up, downloaded Apple Keyboard Update 1.1, and rebooted. Except for the F3 and F4 keys, everything works fine. F3 only brings up Expose, and F4 only brings up Dashboard if I assign these keys appropriately i

  • FM'S or BAPI to update the condition records in VB22 transaction

    Hi, I need your help in getting the FM'S or BAPI to update the condition records in sales deal. The transaction is VB22. If you can send me a smaple code it will be really helpful. Regards, Sasi

  • Please help - critical error!

    I am beginning to get errors with specific pages in my APEX app. This is a mission critical application and the pages I need are data-entry pages. There is nothing in the server logs, so it isn't a DB issue, but I am seeing the following in the Apach