Share to: share facebook share twitter share wa share telegram print page

True y false

true / false
Parte de GNU Core Utilities
Información general
Tipo de programa Orden
Lanzamiento inicial 1 de enero de 1979 (45 años, 8 meses y 13 días)
Información técnica
Plataformas admitidas Multiplataforma

En los sistemas operativos tipo Unix, true y false son comandos cuya única función es regresar siempre con un estado de salida predeterminado. Los programadores y los scripts suelen utilizar el estado de salida de un comando para evaluar el éxito (estado de salida cero) o el fracaso (distinto de cero) del comando. Los comandos true y false representan los valores lógicos de éxito del comando, ya que true devuelve 0 y false devuelve 1.[Nota 1]

Uso

Los comandos suelen emplearse en sentencias condicionales y bucles de scripts de shell. Por ejemplo, el siguiente script de shell repite el bucle echo hola hasta que se interrumpe:

while true
do
  echo hola
done

Los comandos se pueden utilizar para ignorar el éxito o el fracaso de una secuencia de otros comandos, como en el ejemplo:

make  && false

Si se establece el shell de inicio de sesión de un usuario en false, en /etc/passwd, se le deniega el acceso a un shell interactivo, pero su cuenta puede seguir siendo válida para otros servicios, como FTP (Aunque /sbin/nologin, si está disponible, puede ser más adecuado para este propósito, ya que imprime una notificación antes de terminar la sesión).

Los programas no toman parámetros "reales"; en la versión GNU, el parámetro estándar --help muestra un resumen de uso y --version muestra la versión del programa.

Comando nulo

El comando true es a veces sustituido por el comando null que es muy similar,[1]​ escrito como dos puntos (:). El comando null está integrado en el intérprete de comandos y, por lo tanto, puede ser más eficiente si true es un programa externo (true suele ser una función integrada en el intérprete de comandos). Podemos reescribir el ejemplo superior utilizando : en lugar de true:

while :
do
  echo hola
done

El comando null puede tomar parámetros, los cuales son ignorados. También se utiliza como comando ficticio no-op para efectos secundarios tales como asignar valores por defecto a variables de entorno a través de la forma de expansión de parámetros ${parameter:=word}.[2]​ Un ejemplo en Bash:

 : ${TMPDIR:=/tmp}
 : ${EDITOR=$DEFEDITOR}
 : ${USER=${LOGNAME-`whoami`}}

Véase también

Notas

  1. No confundirlos con los valores de la lógica clásica: verdadero (true, 1 o T) y falso (false, 0 o ⊥).

Referencias

  1. «Colon», The Open group base specifications, issue 7, IEEE std 1003.1-2008 .
  2. Cooper, Mendel (April 2011), «Null command», Advanced Bash-scripting guide, 6.3, The Linux documentation project, consultado el 4 de agosto de 2011 .

Enlaces externos

Páginas del manual

  • true(1): No hacer nada, con éxito - GNU Coreutils reference
  • false(1): No hacer nada, sin éxito - Referencia GNU Coreutils
  • true(1): Devuelve un valor verdadero - Página del manual de FreeBSD
  • false(1): Devuelve un valor falso - Página del manual de FreeBSD

This information is adapted from Wikipedia which is publicly available.

Read other articles:

Este artículo o sección necesita referencias que aparezcan en una publicación acreditada.Este aviso fue puesto el 7 de julio de 2015. Universalist National Memorial Church en Washington D. C.. El universalismo es una rama liberal del cristianismo, que adoptó una estructura eclesiástica en Estados Unidos dentro del ámbito protestante, mientras que ha existido en otras iglesias como creencia individual. Afirma la salvación universal (de ahí el nombre), en contraposición a la doc…

Kepulauan di perbatasan Thailand dan Myanmar yang terdiri dari 800 gugus pulau Kepulauan adalah rantai, gugusan, atau kumpulan dari pulau-pulau yang terbentuk secara tektonik. Kata archipelago dalam bahasa Inggris berasal dari bahasa Yunani ἄρχι- - arkhi- (kepala) dan πέλαγος - pelagos (laut) yang berasal dari rekonstruksi linguistik bahasa Yunani abad pertengahan ἀρχιπέλαγος tepatnya nama untuk Laut Aegea, kemudian bergeser untuk merujuk pada Kepulauan Aegea atau merujuk…

بيب روث معلومات شخصية اسم الولادة (بالإنجليزية: George Herman Ruth, Jr.)‏  الميلاد 6 فبراير 1895(1895-02-06)بالتيمور، ماريلاند الوفاة 16 أغسطس 1948 (53 سنة)مدينة نيويورك سبب الوفاة سرطان المريء  مواطنة الولايات المتحدة  استعمال اليد أعسر  الزوجة كلير ميريت روث  الأولاد دوروثي روث 

هذه المقالة يتيمة إذ تصل إليها مقالات أخرى قليلة جدًا. فضلًا، ساعد بإضافة وصلة إليها في مقالات متعلقة بها. (يوليو 2019) جون دروري كلارك معلومات شخصية الميلاد 15 أغسطس 1907  فيربانكس  الوفاة 6 يوليو 1988 (80 سنة)   نيوجيرسي  مواطنة الولايات المتحدة  الحياة العملية الاسم الأد…

Hongdu Yakovlev CJ-7 (L-7) adalah pesawat latih dua-kursi bermesin piston bersama-sama dikembangkan oleh Grup Hongdu Aviation Industry (Hongdu) dan Yak Aircraft Corporation (Yakovlev), terutama untuk Angkatan Udara Tentara Pembebasan Rakyat China (PLAAF). Hongdu Aviation Industry Group adalah produsen pesawat yang merupakan bagian dari China Aviation Industry Perusahaan II. Pesawat ini dimaksudkan untuk menjadi pelatih utama tunggal yang digunakan oleh sekolah-sekolah penerbangan Cina. Proyek CJ…

1977 studio album by Pink FloydAnimalsCover design by HipgnosisStudio album by Pink FloydReleased21 January 1977 (1977-01-21)RecordedApril–December 1976StudioBritannia Row, LondonGenreProgressive rock[1]Length41:40Label Harvest Columbia ProducerPink FloydPink Floyd chronology Wish You Were Here(1975) Animals(1977) The Wall(1979) Alternative coverCover of the 2018 Remix box set Animals is the tenth studio album by the English rock band Pink Floyd, released on 21 J…

Fernsehsendung Titel Dansk Melodi Grand Prix Produktionsland Danemark Dänemark Originalsprache Dänisch Genre Musik Erscheinungsjahre seit 1957 Episoden in 48 Staffeln Ausstrahlungs-turnus 1957–1966,1978–1993,1994–1997,1999–2002seit 2004 Produktions-unternehmen Premiere 1957 auf DR Moderation verschiedene Der Dansk Melodi Grand Prix ist die dänische Vorentscheidung zum Eurovision Song Contest. Sie wird von Danmarks Radio (DR) veranstaltet. Inhaltsverzeichnis 1 Geschichte 1.1 Syste…

Halaman ini berisi artikel tentang Kabupaten. Untuk Kecamatan bernama sama, lihat Kota Kudus, Kudus. Untuk kegunaan lain, lihat Kudus (disambiguasi). Koordinat: 6°51′0″S 110°36′0″E / 6.85000°S 110.60000°E / -6.85000; 110.60000 Kabupaten KudusKabupatenTranskripsi bahasa daerah • Hanacarakaꦏꦸꦢꦸꦱ꧀ • PegonقدوسMasjid Menara Kudus LambangEtimologi: al-QudsJulukan: Kota Kretek, Kota Santri, Jerusalem van JavaMotto:…

United States historic placeLincoln Park Lily PoolU.S. National Register of Historic PlacesU.S. National Historic Landmark DistrictU.S. Historic districtContributing propertyChicago Landmark Show map of ChicagoShow map of IllinoisShow map of the United StatesLocationFullerton Parkway between Cannon and Stockton Drives in Lincoln Park, Chicago, ILArea3 acres (1.2 ha)Built1938; 85 years ago (1938)ArchitectAlfred CaldwellPart ofLincoln Park (ID94001029)NRHP reference…

Jiro HorikoshiJiro Horikoshi ketika mahasiswa Fakultas Teknik Universitas Kekaisaran TokyoLahir22 Juni 1903Fujioka, Prefektur GunmaMeninggal11 Januari 1982TokyoKebangsaanJepangPendidikanUniversitas TokyoHasil kerjaHasil kerja utamaA7M ReppuHasil desain utamaA5MA6M Zero Jiro Horikoshi (堀越 二郎code: ja is deprecated , Horikoshi Jirō, 22 Juni 1903 – 11 Januari 1982) adalah insinyur aeronautika Jepang yang mendesain pesawat-pesawat tempur Jepang selama Perang Dunia II, termasu…

The WeekndThe Weeknd di tahun 2021LahirAbel Makkonen Tesfaye16 Februari 1990 (umur 33)Toronto, Ontario, KanadaKebangsaanKanadaPekerjaan Penyanyi Penulis lagu Produser rekaman Tahun aktif2010–sekarangKarier musikGenre R&B R&B alternatif pop InstrumenVokal,bass,keyboard,gitarLabel XO Republic Artis terkait Drake Future Daft Punk Ariana Grande Lil Uzi Vert Travis Scott Kanye West Bryson Tiller Juicy J Doja Cat Eminem Lana Del Rey French Montana Situs webtheweeknd.com Abel Makkon…

Hartford Athletic 2019 soccer seasonHartford Athletic2019 seasonOwnerHartford Sports GroupHead coachJimmy NielsenStadiumRentschler Field (from May 4 to June 29)Dillon Stadium (from July 13)USL ChampionshipConference: 17thUSLC PlayoffsDid not qualifyU.S. Open CupThird RoundTop goalscorerLeague: Wojciech Wojcik (7)All: Wojciech Wojcik (7)Highest home attendanceLeague/All: 11,346(May 4 vs. Charlotte Independence)Lowest home attendanceLeague: 3,117(July 20 vs. Charleston Battery) All: 400(May 14 vs.…

American former sailor (born 1993) Abby SunderlandAbby Sunderland at the Houston Boat Show in Kemah, Texas, U.S. on April 14, 2011BornAbigail Jillian Sunderland[1] (1993-10-19) October 19, 1993 (age 30)[1]Los Angeles, California, U.S.[1]EducationTrinity Pacific Christian SchoolOccupationFormer sailorKnown forAttempting to become the youngest person to sail around the world soloParentsLaurence Sunderland (father)Marianne Sunderland (mother) Abigail Jillian Sunder…

Academic title for a holder of a doctoral degree Dr. redirects here. For other uses, see DR (disambiguation). Former Vassar College president Catharine Bond Hill wearing doctoral robes. She has a doctorate and can thus carry the title of Doctor. Doctor is an academic title that originates from the Latin word of the same spelling and meaning.[1] The word is originally an agentive noun of the Latin verb docēre [dɔˈkeːrɛ] 'to teach'. It has been used as an academic title in Eur…

Esta página cita fontes, mas que não cobrem todo o conteúdo. Ajude a inserir referências. Conteúdo não verificável pode ser removido.—Encontre fontes: ABW  • CAPES  • Google (N • L • A) (Março de 2012) Miro Miro 0.9.8 rodando em Windows XP Desenvolvedor Participatory Culture Foundation Versão estável 6.0 (5 de abril de 2013; há 10 anos) Sistema operacional Multiplataforma[1] Gênero(s) Tocador de mídia IPTV Licença GPL …

American Negro Leagues baseball player (1878–1966) Baseball player Knucks JamesSecond basemanBorn: May 2, 1878Norfolk, VirginiaDied: June 1966 New York City, New York (aged 88)Batted: RightThrew: RightNegro league baseball debut1905, for the Brooklyn Royal GiantsLast appearance1918, for the Brooklyn Royal Giants Teams Brooklyn Royal Giants (1905–1906, 1917–1918) Cuban X-Giants (1906) Philadelphia Giants (1908–1911)[1] Paterson Smart Set (1912–1913) Schenecta…

LPO

LPO Ідентифікатори Символи LPO, SPO, lactoperoxidase Зовнішні ІД OMIM: 150205 MGI: 1923363 HomoloGene: 21240 GeneCards: LPO Онтологія гена Молекулярна функція • thiocyanate peroxidase activity• oxidoreductase activity• heme binding• зв'язування з іоном металу• peroxidase activity Клітинна компонента • extracellular region• basolateral plasma membrane• екзосома• extracel…

Аерозоль в електронній сигареті (зазвичай відомий як паровий аерозоль) містить хімічні елементи різного рівня.[1] Пар від електронної сигарети імітує тютюновий дим, але самого процесу горіння тютюну не відбувається.[2] Тобто, між затяжками електронні сигарети не ви…

2022 Filipino filmNgayon KayaOfficial release posterDirected byPrime CruzWritten byJen ChuaunsuProduced byPaulo AvelinoStarring Paulo Avelino Janine Gutierrez CinematographyCarlos MauricioEdited byBenjamin TolentinoMusic byLen CalvoProductioncompanies T.Rex Entertainment WASD Films Release date June 22, 2022 (2022-06-22) CountryPhilippinesLanguageFilipino Ngayon Kaya (Maybe Today) is a 2022 Filipino romance drama film directed by Prime Cruz and starring Paulo Avelino and Janine Gu…

Legislative Assembly constituency in Karnataka, India DasarahalliConstituency for the Karnataka Legislative AssemblyConstituency detailsCountryIndiaRegionSouth IndiaStateKarnatakaDistrictBangalore UrbanLS constituencyBangalore NorthReservationNoneMember of Legislative Assembly16th Karnataka Legislative AssemblyIncumbent S. Muniraju PartyBharatiya Janata PartyElected year2023 Dasarahalli Assembly constituency is one of the 224 constituencies in the Karnataka Legislative Assembly of Karnataka a so…

Kembali kehalaman sebelumnya

Lokasi Pengunjung: 18.118.200.149